home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / usr / lib / python2.6 / dist-packages / xapian.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2009-10-28  |  225KB  |  5,804 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import _xapian
  5. import new
  6. new_instancemethod = new.instancemethod
  7.  
  8. try:
  9.     _swig_property = property
  10. except NameError:
  11.     pass
  12.  
  13.  
  14. def _swig_setattr_nondynamic(self, class_type, name, value, static = 1):
  15.     if name == 'thisown':
  16.         return self.this.own(value)
  17.     method = class_type.__swig_setmethods__.get(name, None)
  18.     if method:
  19.         return method(self, value)
  20.     if not static or hasattr(self, name):
  21.         self.__dict__[name] = value
  22.     else:
  23.         raise AttributeError('You cannot add attributes to %s' % self)
  24.     return method
  25.  
  26.  
  27. def _swig_setattr(self, class_type, name, value):
  28.     return _swig_setattr_nondynamic(self, class_type, name, value, 0)
  29.  
  30.  
  31. def _swig_getattr(self, class_type, name):
  32.     if name == 'thisown':
  33.         return self.this.own()
  34.     method = class_type.__swig_getmethods__.get(name, None)
  35.     if method:
  36.         return method(self)
  37.     raise AttributeError, name
  38.  
  39.  
  40. def _swig_repr(self):
  41.     
  42.     try:
  43.         strthis = 'proxy of ' + self.this.__repr__()
  44.     except:
  45.         strthis = ''
  46.  
  47.     return '<%s.%s; %s >' % (self.__class__.__module__, self.__class__.__name__, strthis)
  48.  
  49. import types
  50.  
  51. try:
  52.     _object = types.ObjectType
  53.     _newclass = 1
  54. except AttributeError:
  55.     
  56.     class _object:
  57.         pass
  58.  
  59.     _newclass = 0
  60.  
  61. del types
  62.  
  63. def _swig_setattr_nondynamic_method(set):
  64.     
  65.     def set_attr(self, name, value):
  66.         if name == 'thisown':
  67.             return self.this.own(value)
  68.         if hasattr(self, name) or name == 'this':
  69.             set(self, name, value)
  70.         else:
  71.             raise AttributeError('You cannot add attributes to %s' % self)
  72.         return name == 'thisown'
  73.  
  74.     return set_attr
  75.  
  76.  
  77. try:
  78.     import weakref
  79.     weakref_proxy = weakref.proxy
  80. except:
  81.     
  82.     weakref_proxy = lambda x: x
  83.  
  84.  
  85. class PySwigIterator(object):
  86.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  87.     
  88.     def __init__(self):
  89.         raise AttributeError, 'No constructor defined'
  90.  
  91.     __repr__ = _swig_repr
  92.     __swig_destroy__ = _xapian.delete_PySwigIterator
  93.     
  94.     def __iter__(self):
  95.         return self
  96.  
  97.  
  98. PySwigIterator.value = new_instancemethod(_xapian.PySwigIterator_value, None, PySwigIterator)
  99. PySwigIterator.incr = new_instancemethod(_xapian.PySwigIterator_incr, None, PySwigIterator)
  100. PySwigIterator.decr = new_instancemethod(_xapian.PySwigIterator_decr, None, PySwigIterator)
  101. PySwigIterator.distance = new_instancemethod(_xapian.PySwigIterator_distance, None, PySwigIterator)
  102. PySwigIterator.equal = new_instancemethod(_xapian.PySwigIterator_equal, None, PySwigIterator)
  103. PySwigIterator.copy = new_instancemethod(_xapian.PySwigIterator_copy, None, PySwigIterator)
  104. PySwigIterator.next = new_instancemethod(_xapian.PySwigIterator_next, None, PySwigIterator)
  105. PySwigIterator.previous = new_instancemethod(_xapian.PySwigIterator_previous, None, PySwigIterator)
  106. PySwigIterator.advance = new_instancemethod(_xapian.PySwigIterator_advance, None, PySwigIterator)
  107. PySwigIterator.__eq__ = new_instancemethod(_xapian.PySwigIterator___eq__, None, PySwigIterator)
  108. PySwigIterator.__ne__ = new_instancemethod(_xapian.PySwigIterator___ne__, None, PySwigIterator)
  109. PySwigIterator.__iadd__ = new_instancemethod(_xapian.PySwigIterator___iadd__, None, PySwigIterator)
  110. PySwigIterator.__isub__ = new_instancemethod(_xapian.PySwigIterator___isub__, None, PySwigIterator)
  111. PySwigIterator.__add__ = new_instancemethod(_xapian.PySwigIterator___add__, None, PySwigIterator)
  112. PySwigIterator.__sub__ = new_instancemethod(_xapian.PySwigIterator___sub__, None, PySwigIterator)
  113. PySwigIterator_swigregister = _xapian.PySwigIterator_swigregister
  114. PySwigIterator_swigregister(PySwigIterator)
  115. MSET_DID = _xapian.MSET_DID
  116. MSET_WT = _xapian.MSET_WT
  117. MSET_RANK = _xapian.MSET_RANK
  118. MSET_PERCENT = _xapian.MSET_PERCENT
  119. MSET_DOCUMENT = _xapian.MSET_DOCUMENT
  120. ESET_TNAME = _xapian.ESET_TNAME
  121. ESET_WT = _xapian.ESET_WT
  122.  
  123. class Error(Exception):
  124.     __swig_setmethods__ = { }
  125.     
  126.     __setattr__ = lambda self, name, value: _swig_setattr(self, Error, name, value)
  127.     __swig_getmethods__ = { }
  128.     
  129.     __getattr__ = lambda self, name: _swig_getattr(self, Error, name)
  130.     
  131.     def __init__(self):
  132.         raise AttributeError, 'No constructor defined'
  133.  
  134.     __repr__ = _swig_repr
  135.     __swig_destroy__ = _xapian.delete_Error
  136.  
  137. Error.get_type = new_instancemethod(_xapian.Error_get_type, None, Error)
  138. Error.get_msg = new_instancemethod(_xapian.Error_get_msg, None, Error)
  139. Error.get_context = new_instancemethod(_xapian.Error_get_context, None, Error)
  140. Error.get_error_string = new_instancemethod(_xapian.Error_get_error_string, None, Error)
  141. Error.get_errno = new_instancemethod(_xapian.Error_get_errno, None, Error)
  142. Error.__str__ = new_instancemethod(_xapian.Error___str__, None, Error)
  143. Error_swigregister = _xapian.Error_swigregister
  144. Error_swigregister(Error)
  145.  
  146. class LogicError(Error):
  147.     __swig_setmethods__ = { }
  148.     for _s in [
  149.         Error]:
  150.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  151.     
  152.     
  153.     __setattr__ = lambda self, name, value: _swig_setattr(self, LogicError, name, value)
  154.     __swig_getmethods__ = { }
  155.     for _s in [
  156.         Error]:
  157.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  158.     
  159.     
  160.     __getattr__ = lambda self, name: _swig_getattr(self, LogicError, name)
  161.     
  162.     def __init__(self):
  163.         raise AttributeError, 'No constructor defined'
  164.  
  165.     __repr__ = _swig_repr
  166.     __swig_destroy__ = _xapian.delete_LogicError
  167.  
  168. LogicError_swigregister = _xapian.LogicError_swigregister
  169. LogicError_swigregister(LogicError)
  170.  
  171. class RuntimeError(Error):
  172.     __swig_setmethods__ = { }
  173.     for _s in [
  174.         Error]:
  175.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  176.     
  177.     
  178.     __setattr__ = lambda self, name, value: _swig_setattr(self, RuntimeError, name, value)
  179.     __swig_getmethods__ = { }
  180.     for _s in [
  181.         Error]:
  182.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  183.     
  184.     
  185.     __getattr__ = lambda self, name: _swig_getattr(self, RuntimeError, name)
  186.     
  187.     def __init__(self):
  188.         raise AttributeError, 'No constructor defined'
  189.  
  190.     __repr__ = _swig_repr
  191.     __swig_destroy__ = _xapian.delete_RuntimeError
  192.  
  193. RuntimeError_swigregister = _xapian.RuntimeError_swigregister
  194. RuntimeError_swigregister(RuntimeError)
  195.  
  196. class AssertionError(LogicError):
  197.     __swig_setmethods__ = { }
  198.     for _s in [
  199.         LogicError]:
  200.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  201.     
  202.     
  203.     __setattr__ = lambda self, name, value: _swig_setattr(self, AssertionError, name, value)
  204.     __swig_getmethods__ = { }
  205.     for _s in [
  206.         LogicError]:
  207.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  208.     
  209.     
  210.     __getattr__ = lambda self, name: _swig_getattr(self, AssertionError, name)
  211.     __repr__ = _swig_repr
  212.     
  213.     def __init__(self, *args):
  214.         _xapian.AssertionError_swiginit(self, _xapian.new_AssertionError(*args))
  215.  
  216.     __swig_destroy__ = _xapian.delete_AssertionError
  217.  
  218. AssertionError_swigregister = _xapian.AssertionError_swigregister
  219. AssertionError_swigregister(AssertionError)
  220.  
  221. class InvalidArgumentError(LogicError):
  222.     __swig_setmethods__ = { }
  223.     for _s in [
  224.         LogicError]:
  225.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  226.     
  227.     
  228.     __setattr__ = lambda self, name, value: _swig_setattr(self, InvalidArgumentError, name, value)
  229.     __swig_getmethods__ = { }
  230.     for _s in [
  231.         LogicError]:
  232.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  233.     
  234.     
  235.     __getattr__ = lambda self, name: _swig_getattr(self, InvalidArgumentError, name)
  236.     __repr__ = _swig_repr
  237.     
  238.     def __init__(self, *args):
  239.         _xapian.InvalidArgumentError_swiginit(self, _xapian.new_InvalidArgumentError(*args))
  240.  
  241.     __swig_destroy__ = _xapian.delete_InvalidArgumentError
  242.  
  243. InvalidArgumentError_swigregister = _xapian.InvalidArgumentError_swigregister
  244. InvalidArgumentError_swigregister(InvalidArgumentError)
  245.  
  246. class InvalidOperationError(LogicError):
  247.     __swig_setmethods__ = { }
  248.     for _s in [
  249.         LogicError]:
  250.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  251.     
  252.     
  253.     __setattr__ = lambda self, name, value: _swig_setattr(self, InvalidOperationError, name, value)
  254.     __swig_getmethods__ = { }
  255.     for _s in [
  256.         LogicError]:
  257.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  258.     
  259.     
  260.     __getattr__ = lambda self, name: _swig_getattr(self, InvalidOperationError, name)
  261.     __repr__ = _swig_repr
  262.     
  263.     def __init__(self, *args):
  264.         _xapian.InvalidOperationError_swiginit(self, _xapian.new_InvalidOperationError(*args))
  265.  
  266.     __swig_destroy__ = _xapian.delete_InvalidOperationError
  267.  
  268. InvalidOperationError_swigregister = _xapian.InvalidOperationError_swigregister
  269. InvalidOperationError_swigregister(InvalidOperationError)
  270.  
  271. class UnimplementedError(LogicError):
  272.     __swig_setmethods__ = { }
  273.     for _s in [
  274.         LogicError]:
  275.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  276.     
  277.     
  278.     __setattr__ = lambda self, name, value: _swig_setattr(self, UnimplementedError, name, value)
  279.     __swig_getmethods__ = { }
  280.     for _s in [
  281.         LogicError]:
  282.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  283.     
  284.     
  285.     __getattr__ = lambda self, name: _swig_getattr(self, UnimplementedError, name)
  286.     __repr__ = _swig_repr
  287.     
  288.     def __init__(self, *args):
  289.         _xapian.UnimplementedError_swiginit(self, _xapian.new_UnimplementedError(*args))
  290.  
  291.     __swig_destroy__ = _xapian.delete_UnimplementedError
  292.  
  293. UnimplementedError_swigregister = _xapian.UnimplementedError_swigregister
  294. UnimplementedError_swigregister(UnimplementedError)
  295.  
  296. class DatabaseError(RuntimeError):
  297.     __swig_setmethods__ = { }
  298.     for _s in [
  299.         RuntimeError]:
  300.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  301.     
  302.     
  303.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseError, name, value)
  304.     __swig_getmethods__ = { }
  305.     for _s in [
  306.         RuntimeError]:
  307.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  308.     
  309.     
  310.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseError, name)
  311.     __repr__ = _swig_repr
  312.     
  313.     def __init__(self, *args):
  314.         _xapian.DatabaseError_swiginit(self, _xapian.new_DatabaseError(*args))
  315.  
  316.     __swig_destroy__ = _xapian.delete_DatabaseError
  317.  
  318. DatabaseError_swigregister = _xapian.DatabaseError_swigregister
  319. DatabaseError_swigregister(DatabaseError)
  320.  
  321. class DatabaseCorruptError(DatabaseError):
  322.     __swig_setmethods__ = { }
  323.     for _s in [
  324.         DatabaseError]:
  325.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  326.     
  327.     
  328.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseCorruptError, name, value)
  329.     __swig_getmethods__ = { }
  330.     for _s in [
  331.         DatabaseError]:
  332.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  333.     
  334.     
  335.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseCorruptError, name)
  336.     __repr__ = _swig_repr
  337.     
  338.     def __init__(self, *args):
  339.         _xapian.DatabaseCorruptError_swiginit(self, _xapian.new_DatabaseCorruptError(*args))
  340.  
  341.     __swig_destroy__ = _xapian.delete_DatabaseCorruptError
  342.  
  343. DatabaseCorruptError_swigregister = _xapian.DatabaseCorruptError_swigregister
  344. DatabaseCorruptError_swigregister(DatabaseCorruptError)
  345.  
  346. class DatabaseCreateError(DatabaseError):
  347.     __swig_setmethods__ = { }
  348.     for _s in [
  349.         DatabaseError]:
  350.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  351.     
  352.     
  353.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseCreateError, name, value)
  354.     __swig_getmethods__ = { }
  355.     for _s in [
  356.         DatabaseError]:
  357.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  358.     
  359.     
  360.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseCreateError, name)
  361.     __repr__ = _swig_repr
  362.     
  363.     def __init__(self, *args):
  364.         _xapian.DatabaseCreateError_swiginit(self, _xapian.new_DatabaseCreateError(*args))
  365.  
  366.     __swig_destroy__ = _xapian.delete_DatabaseCreateError
  367.  
  368. DatabaseCreateError_swigregister = _xapian.DatabaseCreateError_swigregister
  369. DatabaseCreateError_swigregister(DatabaseCreateError)
  370.  
  371. class DatabaseLockError(DatabaseError):
  372.     __swig_setmethods__ = { }
  373.     for _s in [
  374.         DatabaseError]:
  375.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  376.     
  377.     
  378.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseLockError, name, value)
  379.     __swig_getmethods__ = { }
  380.     for _s in [
  381.         DatabaseError]:
  382.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  383.     
  384.     
  385.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseLockError, name)
  386.     __repr__ = _swig_repr
  387.     
  388.     def __init__(self, *args):
  389.         _xapian.DatabaseLockError_swiginit(self, _xapian.new_DatabaseLockError(*args))
  390.  
  391.     __swig_destroy__ = _xapian.delete_DatabaseLockError
  392.  
  393. DatabaseLockError_swigregister = _xapian.DatabaseLockError_swigregister
  394. DatabaseLockError_swigregister(DatabaseLockError)
  395.  
  396. class DatabaseModifiedError(DatabaseError):
  397.     __swig_setmethods__ = { }
  398.     for _s in [
  399.         DatabaseError]:
  400.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  401.     
  402.     
  403.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseModifiedError, name, value)
  404.     __swig_getmethods__ = { }
  405.     for _s in [
  406.         DatabaseError]:
  407.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  408.     
  409.     
  410.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseModifiedError, name)
  411.     __repr__ = _swig_repr
  412.     
  413.     def __init__(self, *args):
  414.         _xapian.DatabaseModifiedError_swiginit(self, _xapian.new_DatabaseModifiedError(*args))
  415.  
  416.     __swig_destroy__ = _xapian.delete_DatabaseModifiedError
  417.  
  418. DatabaseModifiedError_swigregister = _xapian.DatabaseModifiedError_swigregister
  419. DatabaseModifiedError_swigregister(DatabaseModifiedError)
  420.  
  421. class DatabaseOpeningError(DatabaseError):
  422.     __swig_setmethods__ = { }
  423.     for _s in [
  424.         DatabaseError]:
  425.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  426.     
  427.     
  428.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseOpeningError, name, value)
  429.     __swig_getmethods__ = { }
  430.     for _s in [
  431.         DatabaseError]:
  432.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  433.     
  434.     
  435.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseOpeningError, name)
  436.     __repr__ = _swig_repr
  437.     
  438.     def __init__(self, *args):
  439.         _xapian.DatabaseOpeningError_swiginit(self, _xapian.new_DatabaseOpeningError(*args))
  440.  
  441.     __swig_destroy__ = _xapian.delete_DatabaseOpeningError
  442.  
  443. DatabaseOpeningError_swigregister = _xapian.DatabaseOpeningError_swigregister
  444. DatabaseOpeningError_swigregister(DatabaseOpeningError)
  445.  
  446. class DatabaseVersionError(DatabaseOpeningError):
  447.     __swig_setmethods__ = { }
  448.     for _s in [
  449.         DatabaseOpeningError]:
  450.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  451.     
  452.     
  453.     __setattr__ = lambda self, name, value: _swig_setattr(self, DatabaseVersionError, name, value)
  454.     __swig_getmethods__ = { }
  455.     for _s in [
  456.         DatabaseOpeningError]:
  457.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  458.     
  459.     
  460.     __getattr__ = lambda self, name: _swig_getattr(self, DatabaseVersionError, name)
  461.     __repr__ = _swig_repr
  462.     
  463.     def __init__(self, *args):
  464.         _xapian.DatabaseVersionError_swiginit(self, _xapian.new_DatabaseVersionError(*args))
  465.  
  466.     __swig_destroy__ = _xapian.delete_DatabaseVersionError
  467.  
  468. DatabaseVersionError_swigregister = _xapian.DatabaseVersionError_swigregister
  469. DatabaseVersionError_swigregister(DatabaseVersionError)
  470.  
  471. class DocNotFoundError(RuntimeError):
  472.     __swig_setmethods__ = { }
  473.     for _s in [
  474.         RuntimeError]:
  475.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  476.     
  477.     
  478.     __setattr__ = lambda self, name, value: _swig_setattr(self, DocNotFoundError, name, value)
  479.     __swig_getmethods__ = { }
  480.     for _s in [
  481.         RuntimeError]:
  482.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  483.     
  484.     
  485.     __getattr__ = lambda self, name: _swig_getattr(self, DocNotFoundError, name)
  486.     __repr__ = _swig_repr
  487.     
  488.     def __init__(self, *args):
  489.         _xapian.DocNotFoundError_swiginit(self, _xapian.new_DocNotFoundError(*args))
  490.  
  491.     __swig_destroy__ = _xapian.delete_DocNotFoundError
  492.  
  493. DocNotFoundError_swigregister = _xapian.DocNotFoundError_swigregister
  494. DocNotFoundError_swigregister(DocNotFoundError)
  495.  
  496. class FeatureUnavailableError(RuntimeError):
  497.     __swig_setmethods__ = { }
  498.     for _s in [
  499.         RuntimeError]:
  500.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  501.     
  502.     
  503.     __setattr__ = lambda self, name, value: _swig_setattr(self, FeatureUnavailableError, name, value)
  504.     __swig_getmethods__ = { }
  505.     for _s in [
  506.         RuntimeError]:
  507.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  508.     
  509.     
  510.     __getattr__ = lambda self, name: _swig_getattr(self, FeatureUnavailableError, name)
  511.     __repr__ = _swig_repr
  512.     
  513.     def __init__(self, *args):
  514.         _xapian.FeatureUnavailableError_swiginit(self, _xapian.new_FeatureUnavailableError(*args))
  515.  
  516.     __swig_destroy__ = _xapian.delete_FeatureUnavailableError
  517.  
  518. FeatureUnavailableError_swigregister = _xapian.FeatureUnavailableError_swigregister
  519. FeatureUnavailableError_swigregister(FeatureUnavailableError)
  520.  
  521. class InternalError(RuntimeError):
  522.     __swig_setmethods__ = { }
  523.     for _s in [
  524.         RuntimeError]:
  525.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  526.     
  527.     
  528.     __setattr__ = lambda self, name, value: _swig_setattr(self, InternalError, name, value)
  529.     __swig_getmethods__ = { }
  530.     for _s in [
  531.         RuntimeError]:
  532.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  533.     
  534.     
  535.     __getattr__ = lambda self, name: _swig_getattr(self, InternalError, name)
  536.     __repr__ = _swig_repr
  537.     
  538.     def __init__(self, *args):
  539.         _xapian.InternalError_swiginit(self, _xapian.new_InternalError(*args))
  540.  
  541.     __swig_destroy__ = _xapian.delete_InternalError
  542.  
  543. InternalError_swigregister = _xapian.InternalError_swigregister
  544. InternalError_swigregister(InternalError)
  545.  
  546. class NetworkError(RuntimeError):
  547.     __swig_setmethods__ = { }
  548.     for _s in [
  549.         RuntimeError]:
  550.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  551.     
  552.     
  553.     __setattr__ = lambda self, name, value: _swig_setattr(self, NetworkError, name, value)
  554.     __swig_getmethods__ = { }
  555.     for _s in [
  556.         RuntimeError]:
  557.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  558.     
  559.     
  560.     __getattr__ = lambda self, name: _swig_getattr(self, NetworkError, name)
  561.     __repr__ = _swig_repr
  562.     
  563.     def __init__(self, *args):
  564.         _xapian.NetworkError_swiginit(self, _xapian.new_NetworkError(*args))
  565.  
  566.     __swig_destroy__ = _xapian.delete_NetworkError
  567.  
  568. NetworkError_swigregister = _xapian.NetworkError_swigregister
  569. NetworkError_swigregister(NetworkError)
  570.  
  571. class NetworkTimeoutError(NetworkError):
  572.     __swig_setmethods__ = { }
  573.     for _s in [
  574.         NetworkError]:
  575.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  576.     
  577.     
  578.     __setattr__ = lambda self, name, value: _swig_setattr(self, NetworkTimeoutError, name, value)
  579.     __swig_getmethods__ = { }
  580.     for _s in [
  581.         NetworkError]:
  582.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  583.     
  584.     
  585.     __getattr__ = lambda self, name: _swig_getattr(self, NetworkTimeoutError, name)
  586.     __repr__ = _swig_repr
  587.     
  588.     def __init__(self, *args):
  589.         _xapian.NetworkTimeoutError_swiginit(self, _xapian.new_NetworkTimeoutError(*args))
  590.  
  591.     __swig_destroy__ = _xapian.delete_NetworkTimeoutError
  592.  
  593. NetworkTimeoutError_swigregister = _xapian.NetworkTimeoutError_swigregister
  594. NetworkTimeoutError_swigregister(NetworkTimeoutError)
  595.  
  596. class QueryParserError(RuntimeError):
  597.     __swig_setmethods__ = { }
  598.     for _s in [
  599.         RuntimeError]:
  600.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  601.     
  602.     
  603.     __setattr__ = lambda self, name, value: _swig_setattr(self, QueryParserError, name, value)
  604.     __swig_getmethods__ = { }
  605.     for _s in [
  606.         RuntimeError]:
  607.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  608.     
  609.     
  610.     __getattr__ = lambda self, name: _swig_getattr(self, QueryParserError, name)
  611.     __repr__ = _swig_repr
  612.     
  613.     def __init__(self, *args):
  614.         _xapian.QueryParserError_swiginit(self, _xapian.new_QueryParserError(*args))
  615.  
  616.     __swig_destroy__ = _xapian.delete_QueryParserError
  617.  
  618. QueryParserError_swigregister = _xapian.QueryParserError_swigregister
  619. QueryParserError_swigregister(QueryParserError)
  620.  
  621. class RangeError(RuntimeError):
  622.     __swig_setmethods__ = { }
  623.     for _s in [
  624.         RuntimeError]:
  625.         __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', { }))
  626.     
  627.     
  628.     __setattr__ = lambda self, name, value: _swig_setattr(self, RangeError, name, value)
  629.     __swig_getmethods__ = { }
  630.     for _s in [
  631.         RuntimeError]:
  632.         __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', { }))
  633.     
  634.     
  635.     __getattr__ = lambda self, name: _swig_getattr(self, RangeError, name)
  636.     __repr__ = _swig_repr
  637.     
  638.     def __init__(self, *args):
  639.         _xapian.RangeError_swiginit(self, _xapian.new_RangeError(*args))
  640.  
  641.     __swig_destroy__ = _xapian.delete_RangeError
  642.  
  643. RangeError_swigregister = _xapian.RangeError_swigregister
  644. RangeError_swigregister(RangeError)
  645. version_string = _xapian.version_string
  646. major_version = _xapian.major_version
  647. minor_version = _xapian.minor_version
  648. revision = _xapian.revision
  649. xapian_version_string = _xapian.xapian_version_string
  650. xapian_major_version = _xapian.xapian_major_version
  651. xapian_minor_version = _xapian.xapian_minor_version
  652. xapian_revision = _xapian.xapian_revision
  653.  
  654. class PositionIterator(object):
  655.     '''
  656.     An iterator pointing to items in a list of positions. 
  657.     '''
  658.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  659.     __repr__ = _swig_repr
  660.     
  661.     def __init__(self, *args):
  662.         '''
  663.         Copying is allowed.
  664.  
  665.         Xapian::PositionIterator::PositionIterator(const PositionIterator &o)
  666.  
  667.         The internals are reference counted, so copying is also cheap. 
  668.         '''
  669.         _xapian.PositionIterator_swiginit(self, _xapian.new_PositionIterator(*args))
  670.  
  671.     __swig_destroy__ = _xapian.delete_PositionIterator
  672.     
  673.     def skip_to(*args):
  674.         '''
  675.         void
  676.         Xapian::PositionIterator::skip_to(Xapian::termpos pos) 
  677.         '''
  678.         return _xapian.PositionIterator_skip_to(*args)
  679.  
  680.     
  681.     def __str__(*args):
  682.         '''
  683.         Return a string describing this object.
  684.  
  685.         std::string Xapian::PositionIterator::get_description() const 
  686.         '''
  687.         return _xapian.PositionIterator___str__(*args)
  688.  
  689.     
  690.     def get_description(*args):
  691.         '''
  692.         Return a string describing this object.
  693.  
  694.         std::string Xapian::PositionIterator::get_description() const 
  695.         '''
  696.         return _xapian.PositionIterator_get_description(*args)
  697.  
  698.  
  699. PositionIterator.get_termpos = new_instancemethod(_xapian.PositionIterator_get_termpos, None, PositionIterator)
  700. PositionIterator.next = new_instancemethod(_xapian.PositionIterator_next, None, PositionIterator)
  701. PositionIterator.equals = new_instancemethod(_xapian.PositionIterator_equals, None, PositionIterator)
  702. PositionIterator.skip_to = new_instancemethod(_xapian.PositionIterator_skip_to, None, PositionIterator)
  703. PositionIterator.__str__ = new_instancemethod(_xapian.PositionIterator___str__, None, PositionIterator)
  704. PositionIterator.get_description = new_instancemethod(_xapian.PositionIterator_get_description, None, PositionIterator)
  705. PositionIterator.__eq__ = new_instancemethod(_xapian.PositionIterator___eq__, None, PositionIterator)
  706. PositionIterator.__ne__ = new_instancemethod(_xapian.PositionIterator___ne__, None, PositionIterator)
  707. PositionIterator_swigregister = _xapian.PositionIterator_swigregister
  708. PositionIterator_swigregister(PositionIterator)
  709. cvar = _xapian.cvar
  710. BAD_VALUENO = cvar.BAD_VALUENO
  711.  
  712. class PostingIterator(object):
  713.     '''
  714.     An iterator pointing to items in a list of postings. 
  715.     '''
  716.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  717.     __repr__ = _swig_repr
  718.     __swig_destroy__ = _xapian.delete_PostingIterator
  719.     
  720.     def __init__(self, *args):
  721.         '''
  722.         Copying is allowed.
  723.  
  724.         Xapian::PostingIterator::PostingIterator(const PostingIterator &other)
  725.  
  726.         The internals are reference counted, so copying is also cheap. 
  727.         '''
  728.         _xapian.PostingIterator_swiginit(self, _xapian.new_PostingIterator(*args))
  729.  
  730.     
  731.     def skip_to(*args):
  732.         """
  733.         Skip the iterator to document did, or the first document after did if
  734.         did isn't in the list of documents being iterated.
  735.  
  736.         void Xapian::PostingIterator::skip_to(Xapian::docid did) 
  737.         """
  738.         return _xapian.PostingIterator_skip_to(*args)
  739.  
  740.     
  741.     def get_doclength(*args):
  742.         '''
  743.         Get the length of the document at the current position in the
  744.         postlist.
  745.  
  746.         Xapian::doclength Xapian::PostingIterator::get_doclength() const
  747.  
  748.         This information may be stored in the postlist, in which case this
  749.         lookup should be extremely fast (indeed, not require further disk
  750.         access). If the information is not present in the postlist, it will be
  751.         retrieved from the database, at a greater performance cost. 
  752.         '''
  753.         return _xapian.PostingIterator_get_doclength(*args)
  754.  
  755.     
  756.     def get_wdf(*args):
  757.         '''
  758.         Get the within document frequency of the document at the current
  759.         position in the postlist.
  760.  
  761.         Xapian::termcount Xapian::PostingIterator::get_wdf() const 
  762.         '''
  763.         return _xapian.PostingIterator_get_wdf(*args)
  764.  
  765.     
  766.     def positionlist_begin(*args):
  767.         '''
  768.         Return PositionIterator pointing to start of positionlist for current
  769.         document.
  770.  
  771.         PositionIterator Xapian::PostingIterator::positionlist_begin() const
  772.  
  773.         '''
  774.         return _xapian.PostingIterator_positionlist_begin(*args)
  775.  
  776.     
  777.     def positionlist_end(*args):
  778.         '''
  779.         Return PositionIterator pointing to end of positionlist for current
  780.         document.
  781.  
  782.         PositionIterator Xapian::PostingIterator::positionlist_end() const 
  783.         '''
  784.         return _xapian.PostingIterator_positionlist_end(*args)
  785.  
  786.     
  787.     def __str__(*args):
  788.         '''
  789.         Return a string describing this object.
  790.  
  791.         std::string Xapian::PostingIterator::get_description() const 
  792.         '''
  793.         return _xapian.PostingIterator___str__(*args)
  794.  
  795.     
  796.     def get_description(*args):
  797.         '''
  798.         Return a string describing this object.
  799.  
  800.         std::string Xapian::PostingIterator::get_description() const 
  801.         '''
  802.         return _xapian.PostingIterator_get_description(*args)
  803.  
  804.  
  805. PostingIterator.skip_to = new_instancemethod(_xapian.PostingIterator_skip_to, None, PostingIterator)
  806. PostingIterator.get_doclength = new_instancemethod(_xapian.PostingIterator_get_doclength, None, PostingIterator)
  807. PostingIterator.get_wdf = new_instancemethod(_xapian.PostingIterator_get_wdf, None, PostingIterator)
  808. PostingIterator.positionlist_begin = new_instancemethod(_xapian.PostingIterator_positionlist_begin, None, PostingIterator)
  809. PostingIterator.positionlist_end = new_instancemethod(_xapian.PostingIterator_positionlist_end, None, PostingIterator)
  810. PostingIterator.__str__ = new_instancemethod(_xapian.PostingIterator___str__, None, PostingIterator)
  811. PostingIterator.get_description = new_instancemethod(_xapian.PostingIterator_get_description, None, PostingIterator)
  812. PostingIterator.__eq__ = new_instancemethod(_xapian.PostingIterator___eq__, None, PostingIterator)
  813. PostingIterator.__ne__ = new_instancemethod(_xapian.PostingIterator___ne__, None, PostingIterator)
  814. PostingIterator.get_docid = new_instancemethod(_xapian.PostingIterator_get_docid, None, PostingIterator)
  815. PostingIterator.next = new_instancemethod(_xapian.PostingIterator_next, None, PostingIterator)
  816. PostingIterator.equals = new_instancemethod(_xapian.PostingIterator_equals, None, PostingIterator)
  817. PostingIterator_swigregister = _xapian.PostingIterator_swigregister
  818. PostingIterator_swigregister(PostingIterator)
  819. __eq__ = _xapian.__eq__
  820. __ne__ = _xapian.__ne__
  821.  
  822. class TermIterator(object):
  823.     '''
  824.     An iterator pointing to items in a list of terms. 
  825.     '''
  826.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  827.     __repr__ = _swig_repr
  828.     
  829.     def __init__(self, *args):
  830.         '''
  831.         Copying is allowed.
  832.  
  833.         Xapian::TermIterator::TermIterator(const TermIterator &other)
  834.  
  835.         The internals are reference counted, so copying is also cheap. 
  836.         '''
  837.         _xapian.TermIterator_swiginit(self, _xapian.new_TermIterator(*args))
  838.  
  839.     __swig_destroy__ = _xapian.delete_TermIterator
  840.     
  841.     def skip_to(*args):
  842.         """
  843.         Skip the iterator to term tname, or the first term after tname if
  844.         tname isn't in the list of terms being iterated.
  845.  
  846.         void Xapian::TermIterator::skip_to(const std::string &tname) 
  847.         """
  848.         return _xapian.TermIterator_skip_to(*args)
  849.  
  850.     
  851.     def get_wdf(*args):
  852.         '''
  853.         Return the wdf of the current term (if meaningful).
  854.  
  855.         Xapian::termcount Xapian::TermIterator::get_wdf() const
  856.  
  857.         The wdf (within document frequency) is the number of occurences of a
  858.         term in a particular document. 
  859.         '''
  860.         return _xapian.TermIterator_get_wdf(*args)
  861.  
  862.     
  863.     def get_termfreq(*args):
  864.         '''
  865.         Return the term frequency of the current term (if meaningful).
  866.  
  867.         Xapian::doccount Xapian::TermIterator::get_termfreq() const
  868.  
  869.         The term frequency is the number of documents which a term indexes. 
  870.         '''
  871.         return _xapian.TermIterator_get_termfreq(*args)
  872.  
  873.     
  874.     def positionlist_begin(*args):
  875.         '''
  876.         Return PositionIterator pointing to start of positionlist for current
  877.         term.
  878.  
  879.         PositionIterator Xapian::TermIterator::positionlist_begin() const 
  880.         '''
  881.         return _xapian.TermIterator_positionlist_begin(*args)
  882.  
  883.     
  884.     def positionlist_end(*args):
  885.         '''
  886.         Return PositionIterator pointing to end of positionlist for current
  887.         term.
  888.  
  889.         PositionIterator Xapian::TermIterator::positionlist_end() const 
  890.         '''
  891.         return _xapian.TermIterator_positionlist_end(*args)
  892.  
  893.     
  894.     def __str__(*args):
  895.         '''
  896.         Return a string describing this object.
  897.  
  898.         std::string Xapian::TermIterator::get_description() const 
  899.         '''
  900.         return _xapian.TermIterator___str__(*args)
  901.  
  902.     
  903.     def get_description(*args):
  904.         '''
  905.         Return a string describing this object.
  906.  
  907.         std::string Xapian::TermIterator::get_description() const 
  908.         '''
  909.         return _xapian.TermIterator_get_description(*args)
  910.  
  911.  
  912. TermIterator.get_term = new_instancemethod(_xapian.TermIterator_get_term, None, TermIterator)
  913. TermIterator.next = new_instancemethod(_xapian.TermIterator_next, None, TermIterator)
  914. TermIterator.equals = new_instancemethod(_xapian.TermIterator_equals, None, TermIterator)
  915. TermIterator.skip_to = new_instancemethod(_xapian.TermIterator_skip_to, None, TermIterator)
  916. TermIterator.get_wdf = new_instancemethod(_xapian.TermIterator_get_wdf, None, TermIterator)
  917. TermIterator.get_termfreq = new_instancemethod(_xapian.TermIterator_get_termfreq, None, TermIterator)
  918. TermIterator.positionlist_begin = new_instancemethod(_xapian.TermIterator_positionlist_begin, None, TermIterator)
  919. TermIterator.positionlist_end = new_instancemethod(_xapian.TermIterator_positionlist_end, None, TermIterator)
  920. TermIterator.__str__ = new_instancemethod(_xapian.TermIterator___str__, None, TermIterator)
  921. TermIterator.get_description = new_instancemethod(_xapian.TermIterator_get_description, None, TermIterator)
  922. TermIterator.__eq__ = new_instancemethod(_xapian.TermIterator___eq__, None, TermIterator)
  923. TermIterator.__ne__ = new_instancemethod(_xapian.TermIterator___ne__, None, TermIterator)
  924. TermIterator_swigregister = _xapian.TermIterator_swigregister
  925. TermIterator_swigregister(TermIterator)
  926.  
  927. class ValueIterator(object):
  928.     '''
  929.     An iterator pointing to values associated with a document. 
  930.     '''
  931.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  932.     __repr__ = _swig_repr
  933.     
  934.     def __init__(self, *args):
  935.         '''
  936.         Copying is allowed (and is cheap).
  937.  
  938.         Xapian::ValueIterator::ValueIterator(const ValueIterator &other) 
  939.         '''
  940.         _xapian.ValueIterator_swiginit(self, _xapian.new_ValueIterator(*args))
  941.  
  942.     __swig_destroy__ = _xapian.delete_ValueIterator
  943.     
  944.     def get_valueno(*args):
  945.         '''
  946.         Get the number of the value at the current position.
  947.  
  948.         Xapian::valueno Xapian::ValueIterator::get_valueno() const 
  949.         '''
  950.         return _xapian.ValueIterator_get_valueno(*args)
  951.  
  952.     
  953.     def __str__(*args):
  954.         '''
  955.         Return a string describing this object.
  956.  
  957.         std::string Xapian::ValueIterator::get_description() const 
  958.         '''
  959.         return _xapian.ValueIterator___str__(*args)
  960.  
  961.     
  962.     def get_description(*args):
  963.         '''
  964.         Return a string describing this object.
  965.  
  966.         std::string Xapian::ValueIterator::get_description() const 
  967.         '''
  968.         return _xapian.ValueIterator_get_description(*args)
  969.  
  970.  
  971. ValueIterator.get_value = new_instancemethod(_xapian.ValueIterator_get_value, None, ValueIterator)
  972. ValueIterator.next = new_instancemethod(_xapian.ValueIterator_next, None, ValueIterator)
  973. ValueIterator.equals = new_instancemethod(_xapian.ValueIterator_equals, None, ValueIterator)
  974. ValueIterator.get_valueno = new_instancemethod(_xapian.ValueIterator_get_valueno, None, ValueIterator)
  975. ValueIterator.__str__ = new_instancemethod(_xapian.ValueIterator___str__, None, ValueIterator)
  976. ValueIterator.get_description = new_instancemethod(_xapian.ValueIterator_get_description, None, ValueIterator)
  977. ValueIterator.__eq__ = new_instancemethod(_xapian.ValueIterator___eq__, None, ValueIterator)
  978. ValueIterator.__ne__ = new_instancemethod(_xapian.ValueIterator___ne__, None, ValueIterator)
  979. ValueIterator_swigregister = _xapian.ValueIterator_swigregister
  980. ValueIterator_swigregister(ValueIterator)
  981.  
  982. class Document(object):
  983.     '''
  984.     A document in the database - holds data, values, terms, and postings.
  985.  
  986.     '''
  987.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  988.     __repr__ = _swig_repr
  989.     
  990.     def __init__(self, *args):
  991.         '''
  992.         Make a new empty Document.
  993.  
  994.         Xapian::Document::Document() 
  995.         '''
  996.         _xapian.Document_swiginit(self, _xapian.new_Document(*args))
  997.  
  998.     __swig_destroy__ = _xapian.delete_Document
  999.     
  1000.     def get_value(*args):
  1001.         '''
  1002.         Get value by number.
  1003.  
  1004.         std::string Xapian::Document::get_value(Xapian::valueno valueno) const
  1005.  
  1006.         Returns an empty string if no value with the given number is present
  1007.         in the document.
  1008.  
  1009.         Parameters:
  1010.         -----------
  1011.  
  1012.         valueno:  The number of the value. 
  1013.         '''
  1014.         return _xapian.Document_get_value(*args)
  1015.  
  1016.     
  1017.     def add_value(*args):
  1018.         '''
  1019.         Add a new value.
  1020.  
  1021.         void Xapian::Document::add_value(Xapian::valueno valueno, const
  1022.         std::string &value)
  1023.  
  1024.         The new value will replace any existing value with the same number (or
  1025.         if the new value is empty, it will remove any existing value with the
  1026.         same number). 
  1027.         '''
  1028.         return _xapian.Document_add_value(*args)
  1029.  
  1030.     
  1031.     def remove_value(*args):
  1032.         '''
  1033.         Remove any value with the given number.
  1034.  
  1035.         void Xapian::Document::remove_value(Xapian::valueno valueno) 
  1036.         '''
  1037.         return _xapian.Document_remove_value(*args)
  1038.  
  1039.     
  1040.     def clear_values(*args):
  1041.         '''
  1042.         Remove all values associated with the document.
  1043.  
  1044.         void Xapian::Document::clear_values() 
  1045.         '''
  1046.         return _xapian.Document_clear_values(*args)
  1047.  
  1048.     
  1049.     def get_data(*args):
  1050.         """
  1051.         Get data stored in the document.
  1052.  
  1053.         std::string Xapian::Document::get_data() const
  1054.  
  1055.         This is a potentially expensive operation, and shouldn't normally be
  1056.         used in a match decider functor. Put data for use by match deciders in
  1057.         a value instead. 
  1058.         """
  1059.         return _xapian.Document_get_data(*args)
  1060.  
  1061.     
  1062.     def set_data(*args):
  1063.         '''
  1064.         Set data stored in the document.
  1065.  
  1066.         void Xapian::Document::set_data(const std::string &data) 
  1067.         '''
  1068.         return _xapian.Document_set_data(*args)
  1069.  
  1070.     
  1071.     def add_posting(*args):
  1072.         '''
  1073.         Add an occurrence of a term at a particular position.
  1074.  
  1075.         void Xapian::Document::add_posting(const std::string &tname,
  1076.         Xapian::termpos tpos, Xapian::termcount wdfinc=1)
  1077.  
  1078.         Multiple occurrences of the term at the same position are represented
  1079.         only once in the positional information, but do increase the wdf.
  1080.  
  1081.         If the term is not already in the document, it will be added to it.
  1082.  
  1083.         Parameters:
  1084.         -----------
  1085.  
  1086.         tname:  The name of the term.
  1087.  
  1088.         tpos:  The position of the term.
  1089.  
  1090.         wdfinc:  The increment that will be applied to the wdf for this term.
  1091.  
  1092.         '''
  1093.         return _xapian.Document_add_posting(*args)
  1094.  
  1095.     
  1096.     def add_term(*args):
  1097.         '''
  1098.         Add a term to the document, without positional information.
  1099.  
  1100.         void Xapian::Document::add_term(const std::string &tname,
  1101.         Xapian::termcount wdfinc=1)
  1102.  
  1103.         Any existing positional information for the term will be left
  1104.         unmodified.
  1105.  
  1106.         Parameters:
  1107.         -----------
  1108.  
  1109.         tname:  The name of the term.
  1110.  
  1111.         wdfinc:  The increment that will be applied to the wdf for this term.
  1112.  
  1113.         '''
  1114.         return _xapian.Document_add_term(*args)
  1115.  
  1116.     
  1117.     def remove_posting(*args):
  1118.         '''
  1119.         Remove a posting of a term from the document.
  1120.  
  1121.         void Xapian::Document::remove_posting(const std::string &tname,
  1122.         Xapian::termpos tpos, Xapian::termcount wdfdec=1)
  1123.  
  1124.         Note that the term will still index the document even if all
  1125.         occurrences are removed. To remove a term from a document completely,
  1126.         use remove_term().
  1127.  
  1128.         Parameters:
  1129.         -----------
  1130.  
  1131.         tname:  The name of the term.
  1132.  
  1133.         tpos:  The position of the term.
  1134.  
  1135.         wdfdec:  The decrement that will be applied to the wdf when removing
  1136.         this posting. The wdf will not go below the value of 0.
  1137.  
  1138.         Parameters:
  1139.         -----------
  1140.  
  1141.         Xapian::InvalidArgumentError:  will be thrown if the term is not at
  1142.         the position specified in the position list for this term in this
  1143.         document.
  1144.  
  1145.         Xapian::InvalidArgumentError:  will be thrown if the term is not in
  1146.         the document 
  1147.         '''
  1148.         return _xapian.Document_remove_posting(*args)
  1149.  
  1150.     
  1151.     def remove_term(*args):
  1152.         '''
  1153.         Remove a term and all postings associated with it.
  1154.  
  1155.         void Xapian::Document::remove_term(const std::string &tname)
  1156.  
  1157.         Parameters:
  1158.         -----------
  1159.  
  1160.         tname:  The name of the term.
  1161.  
  1162.         Parameters:
  1163.         -----------
  1164.  
  1165.         Xapian::InvalidArgumentError:  will be thrown if the term is not in
  1166.         the document 
  1167.         '''
  1168.         return _xapian.Document_remove_term(*args)
  1169.  
  1170.     
  1171.     def clear_terms(*args):
  1172.         '''
  1173.         Remove all terms (and postings) from the document.
  1174.  
  1175.         void Xapian::Document::clear_terms() 
  1176.         '''
  1177.         return _xapian.Document_clear_terms(*args)
  1178.  
  1179.     
  1180.     def termlist_count(*args):
  1181.         '''
  1182.         The length of the termlist - i.e.
  1183.  
  1184.         Xapian::termcount Xapian::Document::termlist_count() const
  1185.  
  1186.         the number of different terms which index this document. 
  1187.         '''
  1188.         return _xapian.Document_termlist_count(*args)
  1189.  
  1190.     
  1191.     def termlist_begin(*args):
  1192.         '''
  1193.         Iterator for the terms in this document.
  1194.  
  1195.         TermIterator Xapian::Document::termlist_begin() const 
  1196.         '''
  1197.         return _xapian.Document_termlist_begin(*args)
  1198.  
  1199.     
  1200.     def termlist_end(*args):
  1201.         '''
  1202.         Equivalent end iterator for termlist_begin().
  1203.  
  1204.         TermIterator Xapian::Document::termlist_end() const 
  1205.         '''
  1206.         return _xapian.Document_termlist_end(*args)
  1207.  
  1208.     
  1209.     def values_count(*args):
  1210.         '''
  1211.         Count the values in this document.
  1212.  
  1213.         Xapian::termcount Xapian::Document::values_count() const 
  1214.         '''
  1215.         return _xapian.Document_values_count(*args)
  1216.  
  1217.     
  1218.     def values_begin(*args):
  1219.         '''
  1220.         Iterator for the values in this document.
  1221.  
  1222.         ValueIterator Xapian::Document::values_begin() const 
  1223.         '''
  1224.         return _xapian.Document_values_begin(*args)
  1225.  
  1226.     
  1227.     def values_end(*args):
  1228.         '''
  1229.         Equivalent end iterator for values_begin().
  1230.  
  1231.         ValueIterator Xapian::Document::values_end() const 
  1232.         '''
  1233.         return _xapian.Document_values_end(*args)
  1234.  
  1235.     
  1236.     def get_docid(*args):
  1237.         '''
  1238.         Get the document id which is associated with this document (if any).
  1239.  
  1240.         docid Xapian::Document::get_docid() const
  1241.  
  1242.         NB If multiple databases are being searched together, then this will
  1243.         be the document id in the individual database, not the merged
  1244.         database!
  1245.  
  1246.         If this document came from a database, return the document id in that
  1247.         database. Otherwise, return 0. 
  1248.         '''
  1249.         return _xapian.Document_get_docid(*args)
  1250.  
  1251.     
  1252.     def __str__(*args):
  1253.         '''
  1254.         Return a string describing this object.
  1255.  
  1256.         std::string Xapian::Document::get_description() const 
  1257.         '''
  1258.         return _xapian.Document___str__(*args)
  1259.  
  1260.     
  1261.     def get_description(*args):
  1262.         '''
  1263.         Return a string describing this object.
  1264.  
  1265.         std::string Xapian::Document::get_description() const 
  1266.         '''
  1267.         return _xapian.Document_get_description(*args)
  1268.  
  1269.  
  1270. Document.get_value = new_instancemethod(_xapian.Document_get_value, None, Document)
  1271. Document.add_value = new_instancemethod(_xapian.Document_add_value, None, Document)
  1272. Document.remove_value = new_instancemethod(_xapian.Document_remove_value, None, Document)
  1273. Document.clear_values = new_instancemethod(_xapian.Document_clear_values, None, Document)
  1274. Document.get_data = new_instancemethod(_xapian.Document_get_data, None, Document)
  1275. Document.set_data = new_instancemethod(_xapian.Document_set_data, None, Document)
  1276. Document.add_posting = new_instancemethod(_xapian.Document_add_posting, None, Document)
  1277. Document.add_term = new_instancemethod(_xapian.Document_add_term, None, Document)
  1278. Document.remove_posting = new_instancemethod(_xapian.Document_remove_posting, None, Document)
  1279. Document.remove_term = new_instancemethod(_xapian.Document_remove_term, None, Document)
  1280. Document.clear_terms = new_instancemethod(_xapian.Document_clear_terms, None, Document)
  1281. Document.termlist_count = new_instancemethod(_xapian.Document_termlist_count, None, Document)
  1282. Document.termlist_begin = new_instancemethod(_xapian.Document_termlist_begin, None, Document)
  1283. Document.termlist_end = new_instancemethod(_xapian.Document_termlist_end, None, Document)
  1284. Document.values_count = new_instancemethod(_xapian.Document_values_count, None, Document)
  1285. Document.values_begin = new_instancemethod(_xapian.Document_values_begin, None, Document)
  1286. Document.values_end = new_instancemethod(_xapian.Document_values_end, None, Document)
  1287. Document.get_docid = new_instancemethod(_xapian.Document_get_docid, None, Document)
  1288. Document.__str__ = new_instancemethod(_xapian.Document___str__, None, Document)
  1289. Document.get_description = new_instancemethod(_xapian.Document_get_description, None, Document)
  1290. Document_swigregister = _xapian.Document_swigregister
  1291. Document_swigregister(Document)
  1292.  
  1293. class MSet(object):
  1294.     '''
  1295.     A match set ( MSet).
  1296.  
  1297.     This class represents (a portion of) the results of a query. 
  1298.     '''
  1299.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  1300.     __repr__ = _swig_repr
  1301.     
  1302.     def __init__(self, *args):
  1303.         '''
  1304.         Copying is allowed (and is cheap).
  1305.  
  1306.         Xapian::MSet::MSet(const MSet &other) 
  1307.         '''
  1308.         _xapian.MSet_swiginit(self, _xapian.new_MSet(*args))
  1309.  
  1310.     __swig_destroy__ = _xapian.delete_MSet
  1311.     
  1312.     def fetch(*args):
  1313.         '''
  1314.         Fetch all the items in the MSet.
  1315.  
  1316.         void Xapian::MSet::fetch() const 
  1317.         '''
  1318.         return _xapian.MSet_fetch(*args)
  1319.  
  1320.     
  1321.     def convert_to_percent(*args):
  1322.         '''
  1323.         Return the percentage score for a particular item.
  1324.  
  1325.         Xapian::percent Xapian::MSet::convert_to_percent(const MSetIterator
  1326.         &it) const 
  1327.         '''
  1328.         return _xapian.MSet_convert_to_percent(*args)
  1329.  
  1330.     
  1331.     def get_termfreq(*args):
  1332.         '''
  1333.         Return the term frequency of the given query term.
  1334.  
  1335.         Xapian::doccount Xapian::MSet::get_termfreq(const std::string &tname)
  1336.         const
  1337.  
  1338.         Parameters:
  1339.         -----------
  1340.  
  1341.         tname:  The term to look for.
  1342.  
  1343.         Parameters:
  1344.         -----------
  1345.  
  1346.         Xapian::InvalidArgumentError:  is thrown if the term was not in the
  1347.         query. 
  1348.         '''
  1349.         return _xapian.MSet_get_termfreq(*args)
  1350.  
  1351.     
  1352.     def get_termweight(*args):
  1353.         '''
  1354.         Return the term weight of the given query term.
  1355.  
  1356.         Xapian::weight Xapian::MSet::get_termweight(const std::string &tname)
  1357.         const
  1358.  
  1359.         Parameters:
  1360.         -----------
  1361.  
  1362.         tname:  The term to look for.
  1363.  
  1364.         Parameters:
  1365.         -----------
  1366.  
  1367.         Xapian::InvalidArgumentError:  is thrown if the term was not in the
  1368.         query. 
  1369.         '''
  1370.         return _xapian.MSet_get_termweight(*args)
  1371.  
  1372.     
  1373.     def get_firstitem(*args):
  1374.         '''
  1375.         The index of the first item in the result which was put into the MSet.
  1376.  
  1377.         Xapian::doccount Xapian::MSet::get_firstitem() const
  1378.  
  1379.         This corresponds to the parameter "first" specified in
  1380.         Xapian::Enquire::get_mset(). A value of 0 corresponds to the highest
  1381.         result being the first item in the MSet. 
  1382.         '''
  1383.         return _xapian.MSet_get_firstitem(*args)
  1384.  
  1385.     
  1386.     def get_matches_lower_bound(*args):
  1387.         '''
  1388.         A lower bound on the number of documents in the database which match
  1389.         the query.
  1390.  
  1391.         Xapian::doccount Xapian::MSet::get_matches_lower_bound() const
  1392.  
  1393.         This figure takes into account collapsing of duplicates, and weighting
  1394.         cutoff values.
  1395.  
  1396.         This number is usually considerably less than the actual number of
  1397.         documents which match the query. 
  1398.         '''
  1399.         return _xapian.MSet_get_matches_lower_bound(*args)
  1400.  
  1401.     
  1402.     def get_matches_estimated(*args):
  1403.         '''
  1404.         An estimate for the number of documents in the database which match
  1405.         the query.
  1406.  
  1407.         Xapian::doccount Xapian::MSet::get_matches_estimated() const
  1408.  
  1409.         This figure takes into account collapsing of duplicates, and weighting
  1410.         cutoff values.
  1411.  
  1412.         This value is returned because there is sometimes a request to display
  1413.         such information. However, our experience is that presenting this
  1414.         value to users causes them to worry about the large number of results,
  1415.         rather than how useful those at the top of the result set are, and is
  1416.         thus undesirable. 
  1417.         '''
  1418.         return _xapian.MSet_get_matches_estimated(*args)
  1419.  
  1420.     
  1421.     def get_matches_upper_bound(*args):
  1422.         '''
  1423.         An upper bound on the number of documents in the database which match
  1424.         the query.
  1425.  
  1426.         Xapian::doccount Xapian::MSet::get_matches_upper_bound() const
  1427.  
  1428.         This figure takes into account collapsing of duplicates, and weighting
  1429.         cutoff values.
  1430.  
  1431.         This number is usually considerably greater than the actual number of
  1432.         documents which match the query. 
  1433.         '''
  1434.         return _xapian.MSet_get_matches_upper_bound(*args)
  1435.  
  1436.     
  1437.     def get_max_possible(*args):
  1438.         '''
  1439.         The maximum possible weight in the MSet.
  1440.  
  1441.         Xapian::weight Xapian::MSet::get_max_possible() const
  1442.  
  1443.         This weight is likely not to be attained in the set of results, but
  1444.         represents an upper bound on the weight which a document could attain
  1445.         for the given query. 
  1446.         '''
  1447.         return _xapian.MSet_get_max_possible(*args)
  1448.  
  1449.     
  1450.     def get_max_attained(*args):
  1451.         '''
  1452.         The greatest weight which is attained by any document in the database.
  1453.  
  1454.         Xapian::weight Xapian::MSet::get_max_attained() const
  1455.  
  1456.         If firstitem == 0 and the primary ordering is by relevance, this is
  1457.         the weight of the first entry in the MSet.
  1458.  
  1459.         If no documents are found by the query, this will be 0.
  1460.  
  1461.         Note that calculation of max_attained requires calculation of at least
  1462.         one result item - therefore, if no items were requested when the query
  1463.         was performed (by specifying maxitems = 0 in
  1464.         Xapian::Enquire::get_mset()), this value will be 0. 
  1465.         '''
  1466.         return _xapian.MSet_get_max_attained(*args)
  1467.  
  1468.     
  1469.     def size(*args):
  1470.         '''
  1471.         The number of items in this MSet.
  1472.  
  1473.         Xapian::doccount Xapian::MSet::size() const 
  1474.         '''
  1475.         return _xapian.MSet_size(*args)
  1476.  
  1477.     
  1478.     def empty(*args):
  1479.         '''
  1480.         Test if this MSet is empty.
  1481.  
  1482.         bool Xapian::MSet::empty() const 
  1483.         '''
  1484.         return _xapian.MSet_empty(*args)
  1485.  
  1486.     
  1487.     def begin(*args):
  1488.         '''
  1489.         Iterator for the terms in this MSet.
  1490.  
  1491.         MSetIterator Xapian::MSet::begin() const 
  1492.         '''
  1493.         return _xapian.MSet_begin(*args)
  1494.  
  1495.     
  1496.     def end(*args):
  1497.         '''
  1498.         End iterator corresponding to begin().
  1499.  
  1500.         MSetIterator Xapian::MSet::end() const 
  1501.         '''
  1502.         return _xapian.MSet_end(*args)
  1503.  
  1504.     
  1505.     def back(*args):
  1506.         '''
  1507.         Iterator pointing to the last element of this MSet.
  1508.  
  1509.         MSetIterator Xapian::MSet::back() const 
  1510.         '''
  1511.         return _xapian.MSet_back(*args)
  1512.  
  1513.     
  1514.     def _get_hit_internal(*args):
  1515.         '''
  1516.         Get an item from the MSet.
  1517.  
  1518.         The supplied index is relative to the start of the MSet, not the absolute rank
  1519.         of the item. 
  1520.         '''
  1521.         return _xapian.MSet__get_hit_internal(*args)
  1522.  
  1523.     
  1524.     def __str__(*args):
  1525.         '''
  1526.         Return a string describing this object.
  1527.  
  1528.         std::string Xapian::MSet::get_description() const 
  1529.         '''
  1530.         return _xapian.MSet___str__(*args)
  1531.  
  1532.     
  1533.     def get_description(*args):
  1534.         '''
  1535.         Return a string describing this object.
  1536.  
  1537.         std::string Xapian::MSet::get_description() const 
  1538.         '''
  1539.         return _xapian.MSet_get_description(*args)
  1540.  
  1541.     items = _swig_property(_xapian.MSet_items_get)
  1542.  
  1543. MSet.fetch = new_instancemethod(_xapian.MSet_fetch, None, MSet)
  1544. MSet.convert_to_percent = new_instancemethod(_xapian.MSet_convert_to_percent, None, MSet)
  1545. MSet.get_termfreq = new_instancemethod(_xapian.MSet_get_termfreq, None, MSet)
  1546. MSet.get_termweight = new_instancemethod(_xapian.MSet_get_termweight, None, MSet)
  1547. MSet.get_firstitem = new_instancemethod(_xapian.MSet_get_firstitem, None, MSet)
  1548. MSet.get_matches_lower_bound = new_instancemethod(_xapian.MSet_get_matches_lower_bound, None, MSet)
  1549. MSet.get_matches_estimated = new_instancemethod(_xapian.MSet_get_matches_estimated, None, MSet)
  1550. MSet.get_matches_upper_bound = new_instancemethod(_xapian.MSet_get_matches_upper_bound, None, MSet)
  1551. MSet.get_max_possible = new_instancemethod(_xapian.MSet_get_max_possible, None, MSet)
  1552. MSet.get_max_attained = new_instancemethod(_xapian.MSet_get_max_attained, None, MSet)
  1553. MSet.size = new_instancemethod(_xapian.MSet_size, None, MSet)
  1554. MSet.empty = new_instancemethod(_xapian.MSet_empty, None, MSet)
  1555. MSet.begin = new_instancemethod(_xapian.MSet_begin, None, MSet)
  1556. MSet.end = new_instancemethod(_xapian.MSet_end, None, MSet)
  1557. MSet.back = new_instancemethod(_xapian.MSet_back, None, MSet)
  1558. MSet._get_hit_internal = new_instancemethod(_xapian.MSet__get_hit_internal, None, MSet)
  1559. MSet.get_document_percentage = new_instancemethod(_xapian.MSet_get_document_percentage, None, MSet)
  1560. MSet.get_document = new_instancemethod(_xapian.MSet_get_document, None, MSet)
  1561. MSet.get_docid = new_instancemethod(_xapian.MSet_get_docid, None, MSet)
  1562. MSet.get_document_id = new_instancemethod(_xapian.MSet_get_document_id, None, MSet)
  1563. MSet.__str__ = new_instancemethod(_xapian.MSet___str__, None, MSet)
  1564. MSet.get_description = new_instancemethod(_xapian.MSet_get_description, None, MSet)
  1565. MSet.__cmp__ = new_instancemethod(_xapian.MSet___cmp__, None, MSet)
  1566. MSet_swigregister = _xapian.MSet_swigregister
  1567. MSet_swigregister(MSet)
  1568.  
  1569. class MSetIterator(object):
  1570.     '''
  1571.     An iterator pointing to items in an MSet.
  1572.  
  1573.     This is used for access to individual results of a match. 
  1574.     '''
  1575.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  1576.     __repr__ = _swig_repr
  1577.     
  1578.     def __init__(self, *args):
  1579.         '''
  1580.         Copying is allowed (and is cheap).
  1581.  
  1582.         Xapian::MSetIterator::MSetIterator(const MSetIterator &other) 
  1583.         '''
  1584.         _xapian.MSetIterator_swiginit(self, _xapian.new_MSetIterator(*args))
  1585.  
  1586.     __swig_destroy__ = _xapian.delete_MSetIterator
  1587.     
  1588.     def get_document(*args):
  1589.         '''
  1590.         Get a Xapian::Document object for the current position.
  1591.  
  1592.         Xapian::Document Xapian::MSetIterator::get_document() const
  1593.  
  1594.         This method returns a Xapian::Document object which provides the
  1595.         information about the document pointed to by the MSetIterator.
  1596.  
  1597.         If the underlying database has suitable support, using this call
  1598.         (rather than asking the database for a document based on its document
  1599.         ID) will enable the system to ensure that the correct data is
  1600.         returned, and that the document has not been deleted or changed since
  1601.         the query was performed.
  1602.  
  1603.         A Xapian::Document object containing the document data.
  1604.  
  1605.         Parameters:
  1606.         -----------
  1607.  
  1608.         Xapian::DocNotFoundError:  The document specified could not be found
  1609.         in the database. 
  1610.         '''
  1611.         return _xapian.MSetIterator_get_document(*args)
  1612.  
  1613.     
  1614.     def get_rank(*args):
  1615.         '''
  1616.         Get the rank of the document at the current position.
  1617.  
  1618.         Xapian::doccount Xapian::MSetIterator::get_rank() const
  1619.  
  1620.         The rank is the position that this document is at in the ordered list
  1621.         of results of the query. The result is 0-based - i.e. the top-ranked
  1622.         document has a rank of 0. 
  1623.         '''
  1624.         return _xapian.MSetIterator_get_rank(*args)
  1625.  
  1626.     
  1627.     def get_weight(*args):
  1628.         '''
  1629.         Get the weight of the document at the current position.
  1630.  
  1631.         Xapian::weight Xapian::MSetIterator::get_weight() const 
  1632.         '''
  1633.         return _xapian.MSetIterator_get_weight(*args)
  1634.  
  1635.     
  1636.     def get_collapse_key(*args):
  1637.         '''
  1638.         Get the collapse key for this document.
  1639.  
  1640.         std::string Xapian::MSetIterator::get_collapse_key() const 
  1641.         '''
  1642.         return _xapian.MSetIterator_get_collapse_key(*args)
  1643.  
  1644.     
  1645.     def get_collapse_count(*args):
  1646.         '''
  1647.         Get an estimate of the number of documents that have been collapsed
  1648.         into this one.
  1649.  
  1650.         Xapian::doccount Xapian::MSetIterator::get_collapse_count() const
  1651.  
  1652.         The estimate will always be less than or equal to the actual number of
  1653.         other documents satisfying the match criteria with the same collapse
  1654.         key as this document.
  1655.  
  1656.         This method may return 0 even though there are other documents with
  1657.         the same collapse key which satisfying the match criteria. However if
  1658.         this method returns non-zero, there definitely are other such
  1659.         documents. So this method may be used to inform the user that there
  1660.         are "at least N other matches in this group", or to control whether
  1661.         to offer a "show other documents in this group" feature (but note
  1662.         that it may not offer it in every case where it would show other
  1663.         documents). 
  1664.         '''
  1665.         return _xapian.MSetIterator_get_collapse_count(*args)
  1666.  
  1667.     
  1668.     def get_percent(*args):
  1669.         '''
  1670.         This returns the weight of the document as a percentage score.
  1671.  
  1672.         Xapian::percent Xapian::MSetIterator::get_percent() const
  1673.  
  1674.         The return value will be an integer in the range 0 to 100: 0 meaning
  1675.         that the item did not match the query at all.
  1676.  
  1677.         The intention is that the highest weighted document will get 100 if it
  1678.         matches all the weight-contributing terms in the query. However,
  1679.         currently it may get a lower percentage score if you use a
  1680.         MatchDecider and the sorting is primarily by value. In this case, the
  1681.         percentage for a particular document may vary depending on the first,
  1682.         max_size, and checkatleast parameters passed to Enquire::get_mset()
  1683.         (this bug is hard to fix without having to apply the MatchDecider to
  1684.         potentially many more documents, which is potentially costly). 
  1685.         '''
  1686.         return _xapian.MSetIterator_get_percent(*args)
  1687.  
  1688.     
  1689.     def __str__(*args):
  1690.         '''
  1691.         Return a string describing this object.
  1692.  
  1693.         std::string Xapian::MSetIterator::get_description() const 
  1694.         '''
  1695.         return _xapian.MSetIterator___str__(*args)
  1696.  
  1697.     
  1698.     def get_description(*args):
  1699.         '''
  1700.         Return a string describing this object.
  1701.  
  1702.         std::string Xapian::MSetIterator::get_description() const 
  1703.         '''
  1704.         return _xapian.MSetIterator_get_description(*args)
  1705.  
  1706.  
  1707. MSetIterator.get_docid = new_instancemethod(_xapian.MSetIterator_get_docid, None, MSetIterator)
  1708. MSetIterator.next = new_instancemethod(_xapian.MSetIterator_next, None, MSetIterator)
  1709. MSetIterator.prev = new_instancemethod(_xapian.MSetIterator_prev, None, MSetIterator)
  1710. MSetIterator.equals = new_instancemethod(_xapian.MSetIterator_equals, None, MSetIterator)
  1711. MSetIterator.get_document = new_instancemethod(_xapian.MSetIterator_get_document, None, MSetIterator)
  1712. MSetIterator.get_rank = new_instancemethod(_xapian.MSetIterator_get_rank, None, MSetIterator)
  1713. MSetIterator.get_weight = new_instancemethod(_xapian.MSetIterator_get_weight, None, MSetIterator)
  1714. MSetIterator.get_collapse_key = new_instancemethod(_xapian.MSetIterator_get_collapse_key, None, MSetIterator)
  1715. MSetIterator.get_collapse_count = new_instancemethod(_xapian.MSetIterator_get_collapse_count, None, MSetIterator)
  1716. MSetIterator.get_percent = new_instancemethod(_xapian.MSetIterator_get_percent, None, MSetIterator)
  1717. MSetIterator.__str__ = new_instancemethod(_xapian.MSetIterator___str__, None, MSetIterator)
  1718. MSetIterator.get_description = new_instancemethod(_xapian.MSetIterator_get_description, None, MSetIterator)
  1719. MSetIterator.__eq__ = new_instancemethod(_xapian.MSetIterator___eq__, None, MSetIterator)
  1720. MSetIterator.__ne__ = new_instancemethod(_xapian.MSetIterator___ne__, None, MSetIterator)
  1721. MSetIterator_swigregister = _xapian.MSetIterator_swigregister
  1722. MSetIterator_swigregister(MSetIterator)
  1723.  
  1724. class ESet(object):
  1725.     '''
  1726.     Class representing an ordered set of expand terms (an ESet).
  1727.  
  1728.     This set represents the results of an expand operation, which is
  1729.     performed by Xapian::Enquire::get_eset(). 
  1730.     '''
  1731.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  1732.     __repr__ = _swig_repr
  1733.     
  1734.     def __init__(self, *args):
  1735.         '''
  1736.         Copying is allowed (and is cheap).
  1737.  
  1738.         Xapian::ESet::ESet(const ESet &other) 
  1739.         '''
  1740.         _xapian.ESet_swiginit(self, _xapian.new_ESet(*args))
  1741.  
  1742.     __swig_destroy__ = _xapian.delete_ESet
  1743.     
  1744.     def get_ebound(*args):
  1745.         '''
  1746.         A lower bound on the number of terms which are in the full set of
  1747.         results of the expand.
  1748.  
  1749.         Xapian::termcount Xapian::ESet::get_ebound() const
  1750.  
  1751.         This will be greater than or equal to size() 
  1752.         '''
  1753.         return _xapian.ESet_get_ebound(*args)
  1754.  
  1755.     
  1756.     def size(*args):
  1757.         '''
  1758.         The number of terms in this E-Set.
  1759.  
  1760.         Xapian::termcount Xapian::ESet::size() const 
  1761.         '''
  1762.         return _xapian.ESet_size(*args)
  1763.  
  1764.     
  1765.     def empty(*args):
  1766.         '''
  1767.         Test if this E-Set is empty.
  1768.  
  1769.         bool Xapian::ESet::empty() const 
  1770.         '''
  1771.         return _xapian.ESet_empty(*args)
  1772.  
  1773.     
  1774.     def begin(*args):
  1775.         '''
  1776.         Iterator for the terms in this E-Set.
  1777.  
  1778.         ESetIterator Xapian::ESet::begin() const 
  1779.         '''
  1780.         return _xapian.ESet_begin(*args)
  1781.  
  1782.     
  1783.     def end(*args):
  1784.         '''
  1785.         End iterator corresponding to begin().
  1786.  
  1787.         ESetIterator Xapian::ESet::end() const 
  1788.         '''
  1789.         return _xapian.ESet_end(*args)
  1790.  
  1791.     
  1792.     def back(*args):
  1793.         '''
  1794.         Iterator pointing to the last element of this E-Set.
  1795.  
  1796.         ESetIterator Xapian::ESet::back() const 
  1797.         '''
  1798.         return _xapian.ESet_back(*args)
  1799.  
  1800.     
  1801.     def __str__(*args):
  1802.         '''
  1803.         Return a string describing this object.
  1804.  
  1805.         std::string Xapian::ESet::get_description() const 
  1806.         '''
  1807.         return _xapian.ESet___str__(*args)
  1808.  
  1809.     
  1810.     def get_description(*args):
  1811.         '''
  1812.         Return a string describing this object.
  1813.  
  1814.         std::string Xapian::ESet::get_description() const 
  1815.         '''
  1816.         return _xapian.ESet_get_description(*args)
  1817.  
  1818.     items = _swig_property(_xapian.ESet_items_get)
  1819.  
  1820. ESet.get_ebound = new_instancemethod(_xapian.ESet_get_ebound, None, ESet)
  1821. ESet.size = new_instancemethod(_xapian.ESet_size, None, ESet)
  1822. ESet.empty = new_instancemethod(_xapian.ESet_empty, None, ESet)
  1823. ESet.begin = new_instancemethod(_xapian.ESet_begin, None, ESet)
  1824. ESet.end = new_instancemethod(_xapian.ESet_end, None, ESet)
  1825. ESet.back = new_instancemethod(_xapian.ESet_back, None, ESet)
  1826. ESet.__str__ = new_instancemethod(_xapian.ESet___str__, None, ESet)
  1827. ESet.get_description = new_instancemethod(_xapian.ESet_get_description, None, ESet)
  1828. ESet_swigregister = _xapian.ESet_swigregister
  1829. ESet_swigregister(ESet)
  1830.  
  1831. class ESetIterator(object):
  1832.     '''
  1833.     Iterate through terms in the ESet. 
  1834.     '''
  1835.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  1836.     __repr__ = _swig_repr
  1837.     
  1838.     def __init__(self, *args):
  1839.         '''
  1840.         Copying is allowed (and is cheap).
  1841.  
  1842.         Xapian::ESetIterator::ESetIterator(const ESetIterator &other) 
  1843.         '''
  1844.         _xapian.ESetIterator_swiginit(self, _xapian.new_ESetIterator(*args))
  1845.  
  1846.     __swig_destroy__ = _xapian.delete_ESetIterator
  1847.     
  1848.     def get_weight(*args):
  1849.         '''
  1850.         Get the weight of the term at the current position.
  1851.  
  1852.         Xapian::weight Xapian::ESetIterator::get_weight() const 
  1853.         '''
  1854.         return _xapian.ESetIterator_get_weight(*args)
  1855.  
  1856.     
  1857.     def __str__(*args):
  1858.         '''
  1859.         Return a string describing this object.
  1860.  
  1861.         std::string Xapian::ESetIterator::get_description() const 
  1862.         '''
  1863.         return _xapian.ESetIterator___str__(*args)
  1864.  
  1865.     
  1866.     def get_description(*args):
  1867.         '''
  1868.         Return a string describing this object.
  1869.  
  1870.         std::string Xapian::ESetIterator::get_description() const 
  1871.         '''
  1872.         return _xapian.ESetIterator_get_description(*args)
  1873.  
  1874.  
  1875. ESetIterator.get_termname = new_instancemethod(_xapian.ESetIterator_get_termname, None, ESetIterator)
  1876. ESetIterator.get_term = new_instancemethod(_xapian.ESetIterator_get_term, None, ESetIterator)
  1877. ESetIterator.next = new_instancemethod(_xapian.ESetIterator_next, None, ESetIterator)
  1878. ESetIterator.prev = new_instancemethod(_xapian.ESetIterator_prev, None, ESetIterator)
  1879. ESetIterator.equals = new_instancemethod(_xapian.ESetIterator_equals, None, ESetIterator)
  1880. ESetIterator.get_weight = new_instancemethod(_xapian.ESetIterator_get_weight, None, ESetIterator)
  1881. ESetIterator.__str__ = new_instancemethod(_xapian.ESetIterator___str__, None, ESetIterator)
  1882. ESetIterator.get_description = new_instancemethod(_xapian.ESetIterator_get_description, None, ESetIterator)
  1883. ESetIterator.__eq__ = new_instancemethod(_xapian.ESetIterator___eq__, None, ESetIterator)
  1884. ESetIterator.__ne__ = new_instancemethod(_xapian.ESetIterator___ne__, None, ESetIterator)
  1885. ESetIterator_swigregister = _xapian.ESetIterator_swigregister
  1886. ESetIterator_swigregister(ESetIterator)
  1887.  
  1888. class RSet(object):
  1889.     '''
  1890.     A relevance set (R-Set).
  1891.  
  1892.     This is the set of documents which are marked as relevant, for use in
  1893.     modifying the term weights, and in performing query expansion. 
  1894.     '''
  1895.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  1896.     __repr__ = _swig_repr
  1897.     
  1898.     def __init__(self, *args):
  1899.         '''
  1900.         Default constructor.
  1901.  
  1902.         Xapian::RSet::RSet() 
  1903.         '''
  1904.         _xapian.RSet_swiginit(self, _xapian.new_RSet(*args))
  1905.  
  1906.     __swig_destroy__ = _xapian.delete_RSet
  1907.     
  1908.     def size(*args):
  1909.         '''
  1910.         The number of documents in this R-Set.
  1911.  
  1912.         Xapian::doccount Xapian::RSet::size() const 
  1913.         '''
  1914.         return _xapian.RSet_size(*args)
  1915.  
  1916.     
  1917.     def empty(*args):
  1918.         '''
  1919.         Test if this R-Set is empty.
  1920.  
  1921.         bool Xapian::RSet::empty() const 
  1922.         '''
  1923.         return _xapian.RSet_empty(*args)
  1924.  
  1925.     
  1926.     def add_document(*args):
  1927.         '''
  1928.         Add a document to the relevance set.
  1929.  
  1930.         void Xapian::RSet::add_document(const Xapian::MSetIterator &i) 
  1931.         '''
  1932.         return _xapian.RSet_add_document(*args)
  1933.  
  1934.     
  1935.     def remove_document(*args):
  1936.         '''
  1937.         Remove a document from the relevance set.
  1938.  
  1939.         void Xapian::RSet::remove_document(const Xapian::MSetIterator &i) 
  1940.         '''
  1941.         return _xapian.RSet_remove_document(*args)
  1942.  
  1943.     
  1944.     def contains(*args):
  1945.         '''
  1946.         Test if a given document in the relevance set.
  1947.  
  1948.         bool Xapian::RSet::contains(const Xapian::MSetIterator &i) const 
  1949.         '''
  1950.         return _xapian.RSet_contains(*args)
  1951.  
  1952.     
  1953.     def __str__(*args):
  1954.         '''
  1955.         Return a string describing this object.
  1956.  
  1957.         std::string Xapian::RSet::get_description() const 
  1958.         '''
  1959.         return _xapian.RSet___str__(*args)
  1960.  
  1961.     
  1962.     def get_description(*args):
  1963.         '''
  1964.         Return a string describing this object.
  1965.  
  1966.         std::string Xapian::RSet::get_description() const 
  1967.         '''
  1968.         return _xapian.RSet_get_description(*args)
  1969.  
  1970.  
  1971. RSet.size = new_instancemethod(_xapian.RSet_size, None, RSet)
  1972. RSet.empty = new_instancemethod(_xapian.RSet_empty, None, RSet)
  1973. RSet.add_document = new_instancemethod(_xapian.RSet_add_document, None, RSet)
  1974. RSet.remove_document = new_instancemethod(_xapian.RSet_remove_document, None, RSet)
  1975. RSet.contains = new_instancemethod(_xapian.RSet_contains, None, RSet)
  1976. RSet.__str__ = new_instancemethod(_xapian.RSet___str__, None, RSet)
  1977. RSet.get_description = new_instancemethod(_xapian.RSet_get_description, None, RSet)
  1978. RSet_swigregister = _xapian.RSet_swigregister
  1979. RSet_swigregister(RSet)
  1980.  
  1981. class MatchDecider(object):
  1982.     '''
  1983.     Base class for matcher decision functor. 
  1984.     '''
  1985.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  1986.     __repr__ = _swig_repr
  1987.     __swig_destroy__ = _xapian.delete_MatchDecider
  1988.     
  1989.     def __init__(self, *args):
  1990.         if self.__class__ == MatchDecider:
  1991.             args = (None,) + args
  1992.         else:
  1993.             args = (self,) + args
  1994.         _xapian.MatchDecider_swiginit(self, _xapian.new_MatchDecider(*args))
  1995.  
  1996.     
  1997.     def __disown__(self):
  1998.         self.this.disown()
  1999.         _xapian.disown_MatchDecider(self)
  2000.         return weakref_proxy(self)
  2001.  
  2002.  
  2003. MatchDecider.__call__ = new_instancemethod(_xapian.MatchDecider___call__, None, MatchDecider)
  2004. MatchDecider_swigregister = _xapian.MatchDecider_swigregister
  2005. MatchDecider_swigregister(MatchDecider)
  2006.  
  2007. class ExpandDecider(object):
  2008.     '''
  2009.     Virtual base class for expand decider functor. 
  2010.     '''
  2011.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2012.     __repr__ = _swig_repr
  2013.     __swig_destroy__ = _xapian.delete_ExpandDecider
  2014.     
  2015.     def __init__(self, *args):
  2016.         if self.__class__ == ExpandDecider:
  2017.             args = (None,) + args
  2018.         else:
  2019.             args = (self,) + args
  2020.         _xapian.ExpandDecider_swiginit(self, _xapian.new_ExpandDecider(*args))
  2021.  
  2022.     
  2023.     def __disown__(self):
  2024.         self.this.disown()
  2025.         _xapian.disown_ExpandDecider(self)
  2026.         return weakref_proxy(self)
  2027.  
  2028.  
  2029. ExpandDecider.__call__ = new_instancemethod(_xapian.ExpandDecider___call__, None, ExpandDecider)
  2030. ExpandDecider_swigregister = _xapian.ExpandDecider_swigregister
  2031. ExpandDecider_swigregister(ExpandDecider)
  2032.  
  2033. class Enquire(object):
  2034.     '''
  2035.     This class provides an interface to the information retrieval system
  2036.     for the purpose of searching.
  2037.  
  2038.     Databases are usually opened lazily, so exceptions may not be thrown
  2039.     where you would expect them to be. You should catch Xapian::Error
  2040.     exceptions when calling any method in Xapian::Enquire.
  2041.  
  2042.     Parameters:
  2043.     -----------
  2044.  
  2045.     Xapian::InvalidArgumentError:  will be thrown if an invalid argument
  2046.     is supplied, for example, an unknown database type. 
  2047.     '''
  2048.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2049.     __repr__ = _swig_repr
  2050.     
  2051.     def __init__(self, *args):
  2052.         '''
  2053.         Create a Xapian::Enquire object.
  2054.  
  2055.         Xapian::Enquire::Enquire(const Database &database, ErrorHandler
  2056.         *errorhandler_=0)
  2057.  
  2058.         This specification cannot be changed once the Xapian::Enquire is
  2059.         opened: you must create a new Xapian::Enquire object to access a
  2060.         different database, or set of databases.
  2061.  
  2062.         The database supplied must have been initialised (ie, must not be the
  2063.         result of calling the Database::Database() constructor). If you need
  2064.         to handle a situation where you have no index gracefully, a database
  2065.         created with InMemory::open() can be passed here, which represents a
  2066.         completely empty database.
  2067.  
  2068.         Parameters:
  2069.         -----------
  2070.  
  2071.         database:  Specification of the database or databases to use.
  2072.  
  2073.         errorhandler_:  A pointer to the error handler to use. Ownership of
  2074.         the object pointed to is not assumed by the Xapian::Enquire object -
  2075.         the user should delete the Xapian::ErrorHandler object after the
  2076.         Xapian::Enquire object is deleted. To use no error handler, this
  2077.         parameter should be 0.
  2078.  
  2079.         Parameters:
  2080.         -----------
  2081.  
  2082.         Xapian::InvalidArgumentError:  will be thrown if an initialised
  2083.         Database object is supplied. 
  2084.         '''
  2085.         _xapian.Enquire_swiginit(self, _xapian.new_Enquire(*args))
  2086.  
  2087.     __swig_destroy__ = _xapian.delete_Enquire
  2088.     
  2089.     def set_query(*args):
  2090.         '''
  2091.         Set the query to run.
  2092.  
  2093.         void Xapian::Enquire::set_query(const Xapian::Query &query,
  2094.         Xapian::termcount qlen=0)
  2095.  
  2096.         Parameters:
  2097.         -----------
  2098.  
  2099.         query:  the new query to run.
  2100.  
  2101.         qlen:  the query length to use in weight calculations - by default the
  2102.         sum of the wqf of all terms is used. 
  2103.         '''
  2104.         return _xapian.Enquire_set_query(*args)
  2105.  
  2106.     
  2107.     def get_query(*args):
  2108.         '''
  2109.         Get the query which has been set.
  2110.  
  2111.         const Xapian::Query& Xapian::Enquire::get_query() const
  2112.  
  2113.         This is only valid after set_query() has been called.
  2114.  
  2115.         Parameters:
  2116.         -----------
  2117.  
  2118.         Xapian::InvalidArgumentError:  will be thrown if query has not yet
  2119.         been set. 
  2120.         '''
  2121.         return _xapian.Enquire_get_query(*args)
  2122.  
  2123.     
  2124.     def set_weighting_scheme(*args):
  2125.         '''
  2126.         Set the weighting scheme to use for queries.
  2127.  
  2128.         void Xapian::Enquire::set_weighting_scheme(const Weight &weight_)
  2129.  
  2130.         Parameters:
  2131.         -----------
  2132.  
  2133.         weight_:  the new weighting scheme. If no weighting scheme is
  2134.         specified, the default is BM25 with the default parameters. 
  2135.         '''
  2136.         return _xapian.Enquire_set_weighting_scheme(*args)
  2137.  
  2138.     
  2139.     def set_collapse_key(*args):
  2140.         """
  2141.         Set the collapse key to use for queries.
  2142.  
  2143.         void Xapian::Enquire::set_collapse_key(Xapian::valueno collapse_key)
  2144.  
  2145.         Parameters:
  2146.         -----------
  2147.  
  2148.         collapse_key:  value number to collapse on - at most one MSet entry
  2149.         with each particular value will be returned.
  2150.  
  2151.         The entry returned will be the best entry with that particular value
  2152.         (highest weight or highest sorting key).
  2153.  
  2154.         An example use might be to create a value for each document containing
  2155.         an MD5 hash of the document contents. Then duplicate documents from
  2156.         different sources can be eliminated at search time (it's better to
  2157.         eliminate duplicates at index time, but this may not be always be
  2158.         possible - for example the search may be over more than one Xapian
  2159.         database).
  2160.  
  2161.         Another use is to group matches in a particular category (e.g. you
  2162.         might collapse a mailing list search on the Subject: so that there's
  2163.         only one result per discussion thread). In this case you can use
  2164.         get_collapse_count() to give the user some idea how many other results
  2165.         there are. And if you index the Subject: as a boolean term as well as
  2166.         putting it in a value, you can offer a link to a non-collapsed search
  2167.         restricted to that thread using a boolean filter.
  2168.  
  2169.         (default is Xapian::BAD_VALUENO which means no collapsing). 
  2170.         """
  2171.         return _xapian.Enquire_set_collapse_key(*args)
  2172.  
  2173.     ASCENDING = _xapian.Enquire_ASCENDING
  2174.     DESCENDING = _xapian.Enquire_DESCENDING
  2175.     DONT_CARE = _xapian.Enquire_DONT_CARE
  2176.     
  2177.     def set_docid_order(*args):
  2178.         '''
  2179.         Set the direction in which documents are ordered by document id in the
  2180.         returned MSet.
  2181.  
  2182.         void Xapian::Enquire::set_docid_order(docid_order order)
  2183.  
  2184.         This order only has an effect on documents which would otherwise have
  2185.         equal rank. For a weighted probabilistic match with no sort value,
  2186.         this means documents with equal weight. For a boolean match, with no
  2187.         sort value, this means all documents. And if a sort value is used,
  2188.         this means documents with equal sort value (and also equal weight if
  2189.         ordering on relevance after the sort).
  2190.  
  2191.         Parameters:
  2192.         -----------
  2193.  
  2194.         order:  This can be: Xapian::Enquire::ASCENDING docids sort in
  2195.         ascending order (default)
  2196.  
  2197.         Xapian::Enquire::DESCENDING docids sort in descending order
  2198.  
  2199.         Xapian::Enquire::DONT_CARE docids sort in whatever order is most
  2200.         efficient for the backend
  2201.  
  2202.         Note: If you add documents in strict date order, then a boolean search
  2203.         - i.e. set_weighting_scheme(Xapian::BoolWeight()) - with
  2204.         set_docid_order(Xapian::Enquire::DESCENDING) is a very efficient way
  2205.         to perform "sort by date, newest first". 
  2206.         '''
  2207.         return _xapian.Enquire_set_docid_order(*args)
  2208.  
  2209.     
  2210.     def set_cutoff(*args):
  2211.         """
  2212.         Set the percentage and/or weight cutoffs.
  2213.  
  2214.         void Xapian::Enquire::set_cutoff(Xapian::percent percent_cutoff,
  2215.         Xapian::weight weight_cutoff=0)
  2216.  
  2217.         Parameters:
  2218.         -----------
  2219.  
  2220.         percent_cutoff:  Minimum percentage score for returned documents. If a
  2221.         document has a lower percentage score than this, it will not appear in
  2222.         the MSet. If your intention is to return only matches which contain
  2223.         all the terms in the query, then it's more efficient to use
  2224.         Xapian::Query::OP_AND instead of Xapian::Query::OP_OR in the query
  2225.         than to use set_cutoff(100). (default 0 => no percentage cut-off).
  2226.  
  2227.         weight_cutoff:  Minimum weight for a document to be returned. If a
  2228.         document has a lower score that this, it will not appear in the MSet.
  2229.         It is usually only possible to choose an appropriate weight for cutoff
  2230.         based on the results of a previous run of the same query; this is thus
  2231.         mainly useful for alerting operations. The other potential use is with
  2232.         a user specified weighting scheme. (default 0 => no weight cut-off).
  2233.  
  2234.         """
  2235.         return _xapian.Enquire_set_cutoff(*args)
  2236.  
  2237.     
  2238.     def set_sort_by_relevance(*args):
  2239.         '''
  2240.         Set the sorting to be by relevance only.
  2241.  
  2242.         void Xapian::Enquire::set_sort_by_relevance()
  2243.  
  2244.         This is the default. 
  2245.         '''
  2246.         return _xapian.Enquire_set_sort_by_relevance(*args)
  2247.  
  2248.     
  2249.     def set_sort_by_value(*args):
  2250.         """
  2251.         Set the sorting to be by value only.
  2252.  
  2253.         void Xapian::Enquire::set_sort_by_value(Xapian::valueno sort_key, bool
  2254.         reverse=true)
  2255.  
  2256.         NB sorting of values uses a string comparison, so you'll need to store
  2257.         numbers padded with leading zeros or spaces, or with the number of
  2258.         digits prepended.
  2259.  
  2260.         Parameters:
  2261.         -----------
  2262.  
  2263.         sort_key:  value number to sort on.
  2264.  
  2265.         reverse:  If true, reverses the sort order. (default true, but this
  2266.         default is confusing and deprecated in 1.1.0, so we recommend
  2267.         specifying this parameter explicitly). 
  2268.         """
  2269.         return _xapian.Enquire_set_sort_by_value(*args)
  2270.  
  2271.     
  2272.     def set_sort_by_value_then_relevance(*args):
  2273.         """
  2274.         Set the sorting to be by value, then by relevance for documents with
  2275.         the same value.
  2276.  
  2277.         void Xapian::Enquire::set_sort_by_value_then_relevance(Xapian::valueno
  2278.         sort_key, bool reverse=true)
  2279.  
  2280.         NB sorting of values uses a string comparison, so you'll need to store
  2281.         numbers padded with leading zeros or spaces, or with the number of
  2282.         digits prepended.
  2283.  
  2284.         Parameters:
  2285.         -----------
  2286.  
  2287.         sort_key:  value number to sort on.
  2288.  
  2289.         reverse:  If true, reverses the sort order. (default true, but this
  2290.         default is confusing and deprecated in 1.1.0, so we recommend
  2291.         specifying this parameter explicitly). 
  2292.         """
  2293.         return _xapian.Enquire_set_sort_by_value_then_relevance(*args)
  2294.  
  2295.     
  2296.     def set_sort_by_relevance_then_value(*args):
  2297.         """
  2298.         Set the sorting to be by relevance then value.
  2299.  
  2300.         void Xapian::Enquire::set_sort_by_relevance_then_value(Xapian::valueno
  2301.         sort_key, bool reverse=true)
  2302.  
  2303.         NB sorting of values uses a string comparison, so you'll need to store
  2304.         numbers padded with leading zeros or spaces, or with the number of
  2305.         digits prepended.
  2306.  
  2307.         Note that with the default BM25 weighting scheme parameters, non-
  2308.         identical documents will rarely have the same weight, so this setting
  2309.         will give very similar results to set_sort_by_relevance(). It becomes
  2310.         more useful with particular BM25 parameter settings (e.g.
  2311.         BM25Weight(1,0,1,0,0)) or custom weighting schemes.
  2312.  
  2313.         Parameters:
  2314.         -----------
  2315.  
  2316.         sort_key:  value number to sort on.
  2317.  
  2318.         reverse:  If true, reverses the sort order. (default true, but this
  2319.         default is confusing and deprecated in 1.1.0, so we recommend
  2320.         specifying this parameter explicitly). 
  2321.         """
  2322.         return _xapian.Enquire_set_sort_by_relevance_then_value(*args)
  2323.  
  2324.     
  2325.     def set_sort_by_key(*args):
  2326.         '''
  2327.         Set the sorting to be by key generated from values only.
  2328.  
  2329.         void Xapian::Enquire::set_sort_by_key(Xapian::Sorter *sorter, bool
  2330.         reverse=true)
  2331.  
  2332.         Parameters:
  2333.         -----------
  2334.  
  2335.         sorter:  The functor to use for generating keys.
  2336.  
  2337.         reverse:  If true, reverses the sort order. (default true, but this
  2338.         default is confusing and deprecated in 1.1.0, so we recommend
  2339.         specifying this parameter explicitly). 
  2340.         '''
  2341.         return _xapian.Enquire_set_sort_by_key(*args)
  2342.  
  2343.     
  2344.     def set_sort_by_key_then_relevance(*args):
  2345.         '''
  2346.         Set the sorting to be by keys generated from values, then by relevance
  2347.         for documents with identical keys.
  2348.  
  2349.         void Xapian::Enquire::set_sort_by_key_then_relevance(Xapian::Sorter
  2350.         *sorter, bool reverse=true)
  2351.  
  2352.         Parameters:
  2353.         -----------
  2354.  
  2355.         sorter:  The functor to use for generating keys.
  2356.  
  2357.         reverse:  If true, reverses the sort order. (default true, but this
  2358.         default is confusing and deprecated in 1.1.0, so we recommend
  2359.         specifying this parameter explicitly). 
  2360.         '''
  2361.         return _xapian.Enquire_set_sort_by_key_then_relevance(*args)
  2362.  
  2363.     
  2364.     def set_sort_by_relevance_then_key(*args):
  2365.         '''
  2366.         Set the sorting to be by relevance, then by keys generated from
  2367.         values.
  2368.  
  2369.         void Xapian::Enquire::set_sort_by_relevance_then_key(Xapian::Sorter
  2370.         *sorter, bool reverse=true)
  2371.  
  2372.         Note that with the default BM25 weighting scheme parameters, non-
  2373.         identical documents will rarely have the same weight, so this setting
  2374.         will give very similar results to set_sort_by_relevance(). It becomes
  2375.         more useful with particular BM25 parameter settings (e.g.
  2376.         BM25Weight(1,0,1,0,0)) or custom weighting schemes.
  2377.  
  2378.         Parameters:
  2379.         -----------
  2380.  
  2381.         sorter:  The functor to use for generating keys.
  2382.  
  2383.         reverse:  If true, reverses the sort order. (default true, but this
  2384.         default is confusing and deprecated in 1.1.0, so we recommend
  2385.         specifying this parameter explicitly). 
  2386.         '''
  2387.         return _xapian.Enquire_set_sort_by_relevance_then_key(*args)
  2388.  
  2389.     INCLUDE_QUERY_TERMS = _xapian.Enquire_INCLUDE_QUERY_TERMS
  2390.     USE_EXACT_TERMFREQ = _xapian.Enquire_USE_EXACT_TERMFREQ
  2391.     
  2392.     def get_mset(*args):
  2393.         '''
  2394.         MSet
  2395.         Xapian::Enquire::get_mset(Xapian::doccount first, Xapian::doccount
  2396.         maxitems, const RSet *omrset, const MatchDecider *mdecider=0) const 
  2397.         '''
  2398.         return _xapian.Enquire_get_mset(*args)
  2399.  
  2400.     
  2401.     def get_eset(*args):
  2402.         '''
  2403.         Get the expand set for the given rset.
  2404.  
  2405.         ESet Xapian::Enquire::get_eset(Xapian::termcount maxitems, const RSet
  2406.         &omrset, const Xapian::ExpandDecider *edecider) const
  2407.  
  2408.         Parameters:
  2409.         -----------
  2410.  
  2411.         maxitems:  the maximum number of items to return.
  2412.  
  2413.         omrset:  the relevance set to use when performing the expand
  2414.         operation.
  2415.  
  2416.         edecider:  a decision functor to use to decide whether a given term
  2417.         should be put in the ESet
  2418.  
  2419.         An ESet object containing the results of the expand.
  2420.  
  2421.         Parameters:
  2422.         -----------
  2423.  
  2424.         Xapian::InvalidArgumentError:  See class documentation. 
  2425.         '''
  2426.         return _xapian.Enquire_get_eset(*args)
  2427.  
  2428.     
  2429.     def get_matching_terms_begin(*args):
  2430.         '''
  2431.         Get terms which match a given document, by match set item.
  2432.  
  2433.         TermIterator Xapian::Enquire::get_matching_terms_begin(const
  2434.         MSetIterator &it) const
  2435.  
  2436.         This method returns the terms in the current query which match the
  2437.         given document.
  2438.  
  2439.         If the underlying database has suitable support, using this call
  2440.         (rather than passing a Xapian::docid) will enable the system to ensure
  2441.         that the correct data is returned, and that the document has not been
  2442.         deleted or changed since the query was performed.
  2443.  
  2444.         Parameters:
  2445.         -----------
  2446.  
  2447.         it:  The iterator for which to retrieve the matching terms.
  2448.  
  2449.         An iterator returning the terms which match the document. The terms
  2450.         will be returned (as far as this makes any sense) in the same order as
  2451.         the terms in the query. Terms will not occur more than once, even if
  2452.         they do in the query.
  2453.  
  2454.         Parameters:
  2455.         -----------
  2456.  
  2457.         Xapian::InvalidArgumentError:  See class documentation.
  2458.  
  2459.         Xapian::DocNotFoundError:  The document specified could not be found
  2460.         in the database. 
  2461.         '''
  2462.         return _xapian.Enquire_get_matching_terms_begin(*args)
  2463.  
  2464.     
  2465.     def get_matching_terms_end(*args):
  2466.         '''
  2467.         End iterator corresponding to get_matching_terms_begin().
  2468.  
  2469.         TermIterator Xapian::Enquire::get_matching_terms_end(const
  2470.         MSetIterator &) const 
  2471.         '''
  2472.         return _xapian.Enquire_get_matching_terms_end(*args)
  2473.  
  2474.     
  2475.     def __str__(*args):
  2476.         '''
  2477.         Return a string describing this object.
  2478.  
  2479.         std::string Xapian::Enquire::get_description() const 
  2480.         '''
  2481.         return _xapian.Enquire___str__(*args)
  2482.  
  2483.     
  2484.     def get_description(*args):
  2485.         '''
  2486.         Return a string describing this object.
  2487.  
  2488.         std::string Xapian::Enquire::get_description() const 
  2489.         '''
  2490.         return _xapian.Enquire_get_description(*args)
  2491.  
  2492.  
  2493. Enquire.set_query = new_instancemethod(_xapian.Enquire_set_query, None, Enquire)
  2494. Enquire.get_query = new_instancemethod(_xapian.Enquire_get_query, None, Enquire)
  2495. Enquire.set_weighting_scheme = new_instancemethod(_xapian.Enquire_set_weighting_scheme, None, Enquire)
  2496. Enquire.set_collapse_key = new_instancemethod(_xapian.Enquire_set_collapse_key, None, Enquire)
  2497. Enquire.set_docid_order = new_instancemethod(_xapian.Enquire_set_docid_order, None, Enquire)
  2498. Enquire.set_cutoff = new_instancemethod(_xapian.Enquire_set_cutoff, None, Enquire)
  2499. Enquire.set_sort_by_relevance = new_instancemethod(_xapian.Enquire_set_sort_by_relevance, None, Enquire)
  2500. Enquire.set_sort_by_value = new_instancemethod(_xapian.Enquire_set_sort_by_value, None, Enquire)
  2501. Enquire.set_sort_by_value_then_relevance = new_instancemethod(_xapian.Enquire_set_sort_by_value_then_relevance, None, Enquire)
  2502. Enquire.set_sort_by_relevance_then_value = new_instancemethod(_xapian.Enquire_set_sort_by_relevance_then_value, None, Enquire)
  2503. Enquire.set_sort_by_key = new_instancemethod(_xapian.Enquire_set_sort_by_key, None, Enquire)
  2504. Enquire.set_sort_by_key_then_relevance = new_instancemethod(_xapian.Enquire_set_sort_by_key_then_relevance, None, Enquire)
  2505. Enquire.set_sort_by_relevance_then_key = new_instancemethod(_xapian.Enquire_set_sort_by_relevance_then_key, None, Enquire)
  2506. Enquire.get_mset = new_instancemethod(_xapian.Enquire_get_mset, None, Enquire)
  2507. Enquire.get_eset = new_instancemethod(_xapian.Enquire_get_eset, None, Enquire)
  2508. Enquire.get_matching_terms_begin = new_instancemethod(_xapian.Enquire_get_matching_terms_begin, None, Enquire)
  2509. Enquire.get_matching_terms_end = new_instancemethod(_xapian.Enquire_get_matching_terms_end, None, Enquire)
  2510. Enquire.register_match_decider = new_instancemethod(_xapian.Enquire_register_match_decider, None, Enquire)
  2511. Enquire.get_matching_terms = new_instancemethod(_xapian.Enquire_get_matching_terms, None, Enquire)
  2512. Enquire.__str__ = new_instancemethod(_xapian.Enquire___str__, None, Enquire)
  2513. Enquire.get_description = new_instancemethod(_xapian.Enquire_get_description, None, Enquire)
  2514. Enquire_swigregister = _xapian.Enquire_swigregister
  2515. Enquire_swigregister(Enquire)
  2516.  
  2517. class Weight(object):
  2518.     '''
  2519.     Abstract base class for weighting schemes. 
  2520.     '''
  2521.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2522.     
  2523.     def __init__(self):
  2524.         raise AttributeError, 'No constructor defined'
  2525.  
  2526.     __repr__ = _swig_repr
  2527.     __swig_destroy__ = _xapian.delete_Weight
  2528.     
  2529.     def name(*args):
  2530.         '''
  2531.         Name of the weighting scheme.
  2532.  
  2533.         virtual std::string Xapian::Weight::name() const=0
  2534.  
  2535.         If the subclass is called FooWeight, this should return "Foo". 
  2536.         '''
  2537.         return _xapian.Weight_name(*args)
  2538.  
  2539.     
  2540.     def serialise(*args):
  2541.         '''
  2542.         Serialise object parameters into a string.
  2543.  
  2544.         virtual std::string Xapian::Weight::serialise() const=0 
  2545.         '''
  2546.         return _xapian.Weight_serialise(*args)
  2547.  
  2548.     
  2549.     def unserialise(*args):
  2550.         '''
  2551.         Create object given string serialisation returned by serialise().
  2552.  
  2553.         virtual Weight* Xapian::Weight::unserialise(const std::string &s)
  2554.         const=0 
  2555.         '''
  2556.         return _xapian.Weight_unserialise(*args)
  2557.  
  2558.     
  2559.     def get_sumpart(*args):
  2560.         '''
  2561.         Get a weight which is part of the sum over terms being performed.
  2562.  
  2563.         virtual Xapian::weight Xapian::Weight::get_sumpart(Xapian::termcount
  2564.         wdf, Xapian::doclength len) const=0
  2565.  
  2566.         This returns a weight for a given term and document. These weights are
  2567.         summed to give a total weight for the document.
  2568.  
  2569.         Parameters:
  2570.         -----------
  2571.  
  2572.         wdf:  the within document frequency of the term.
  2573.  
  2574.         len:  the (unnormalised) document length. 
  2575.         '''
  2576.         return _xapian.Weight_get_sumpart(*args)
  2577.  
  2578.     
  2579.     def get_maxpart(*args):
  2580.         '''
  2581.         Gets the maximum value that get_sumpart() may return.
  2582.  
  2583.         virtual Xapian::weight Xapian::Weight::get_maxpart() const=0
  2584.  
  2585.         This is used in optimising searches, by having the postlist tree decay
  2586.         appropriately when parts of it can have limited, or no, further
  2587.         effect. 
  2588.         '''
  2589.         return _xapian.Weight_get_maxpart(*args)
  2590.  
  2591.     
  2592.     def get_sumextra(*args):
  2593.         '''
  2594.         Get an extra weight for a document to add to the sum calculated over
  2595.         the query terms.
  2596.  
  2597.         virtual Xapian::weight Xapian::Weight::get_sumextra(Xapian::doclength
  2598.         len) const=0
  2599.  
  2600.         This returns a weight for a given document, and is used by some
  2601.         weighting schemes to account for influence such as document length.
  2602.  
  2603.         Parameters:
  2604.         -----------
  2605.  
  2606.         len:  the (unnormalised) document length. 
  2607.         '''
  2608.         return _xapian.Weight_get_sumextra(*args)
  2609.  
  2610.     
  2611.     def get_maxextra(*args):
  2612.         '''
  2613.         Gets the maximum value that get_sumextra() may return.
  2614.  
  2615.         virtual Xapian::weight Xapian::Weight::get_maxextra() const=0
  2616.  
  2617.         This is used in optimising searches. 
  2618.         '''
  2619.         return _xapian.Weight_get_maxextra(*args)
  2620.  
  2621.     
  2622.     def get_sumpart_needs_doclength(*args):
  2623.         """
  2624.         return false if the weight object doesn't need doclength
  2625.  
  2626.         virtual bool Xapian::Weight::get_sumpart_needs_doclength() const 
  2627.         """
  2628.         return _xapian.Weight_get_sumpart_needs_doclength(*args)
  2629.  
  2630.  
  2631. Weight.name = new_instancemethod(_xapian.Weight_name, None, Weight)
  2632. Weight.serialise = new_instancemethod(_xapian.Weight_serialise, None, Weight)
  2633. Weight.unserialise = new_instancemethod(_xapian.Weight_unserialise, None, Weight)
  2634. Weight.get_sumpart = new_instancemethod(_xapian.Weight_get_sumpart, None, Weight)
  2635. Weight.get_maxpart = new_instancemethod(_xapian.Weight_get_maxpart, None, Weight)
  2636. Weight.get_sumextra = new_instancemethod(_xapian.Weight_get_sumextra, None, Weight)
  2637. Weight.get_maxextra = new_instancemethod(_xapian.Weight_get_maxextra, None, Weight)
  2638. Weight.get_sumpart_needs_doclength = new_instancemethod(_xapian.Weight_get_sumpart_needs_doclength, None, Weight)
  2639. Weight_swigregister = _xapian.Weight_swigregister
  2640. Weight_swigregister(Weight)
  2641.  
  2642. class BoolWeight(Weight):
  2643.     '''
  2644.     Boolean weighting scheme (everything gets 0). 
  2645.     '''
  2646.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2647.     __repr__ = _swig_repr
  2648.     
  2649.     def clone(*args):
  2650.         '''
  2651.         Return a new weight object of this type.
  2652.  
  2653.         BoolWeight* Xapian::BoolWeight::clone() const
  2654.  
  2655.         A subclass called FooWeight taking parameters param1 and param2 should
  2656.         implement this as:
  2657.  
  2658.         virtual FooWeight * clone() const { return new FooWeight(param1,
  2659.         param2); } 
  2660.         '''
  2661.         return _xapian.BoolWeight_clone(*args)
  2662.  
  2663.     
  2664.     def __init__(self, *args):
  2665.         '''Xapian::BoolWeight::BoolWeight() '''
  2666.         _xapian.BoolWeight_swiginit(self, _xapian.new_BoolWeight(*args))
  2667.  
  2668.     __swig_destroy__ = _xapian.delete_BoolWeight
  2669.     
  2670.     def unserialise(*args):
  2671.         '''
  2672.         Create object given string serialisation returned by serialise().
  2673.  
  2674.         BoolWeight* Xapian::BoolWeight::unserialise(const std::string &s)
  2675.         const 
  2676.         '''
  2677.         return _xapian.BoolWeight_unserialise(*args)
  2678.  
  2679.  
  2680. BoolWeight.clone = new_instancemethod(_xapian.BoolWeight_clone, None, BoolWeight)
  2681. BoolWeight.unserialise = new_instancemethod(_xapian.BoolWeight_unserialise, None, BoolWeight)
  2682. BoolWeight_swigregister = _xapian.BoolWeight_swigregister
  2683. BoolWeight_swigregister(BoolWeight)
  2684.  
  2685. class BM25Weight(Weight):
  2686.     '''
  2687.     BM25 weighting scheme.
  2688.  
  2689.     BM25 weighting options : The BM25 formula is \\[
  2690.     \\frac{k_{2}.n_{q}}{1+L_{d}}+\\sum_{t}\\frac{(k_{3}+1)q_{t
  2691.     }}{k_{3}+q_{t}}.\\frac{(k_{1}+1)f_{t,d}}{k_{1}((1-b)+bL_{d})+f_{t,d}
  2692.     }.w_{t} \\] where  $w_{t}$ is the termweight of term t
  2693.  
  2694.     $f_{t,d}$ is the within document frequency of term t in document d
  2695.  
  2696.     $q_{t}$ is the within query frequency of term t
  2697.  
  2698.     $L_{d}$ is the normalised length of document d
  2699.  
  2700.     $n_{q}$ is the size of the query
  2701.  
  2702.     $k_{1}$, $k_{2}$, $k_{3}$ and $b$ are user specified parameters 
  2703.     '''
  2704.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2705.     __repr__ = _swig_repr
  2706.     
  2707.     def __init__(self, *args):
  2708.         '''Xapian::BM25Weight::BM25Weight() '''
  2709.         _xapian.BM25Weight_swiginit(self, _xapian.new_BM25Weight(*args))
  2710.  
  2711.     
  2712.     def clone(*args):
  2713.         '''
  2714.         Return a new weight object of this type.
  2715.  
  2716.         BM25Weight* Xapian::BM25Weight::clone() const
  2717.  
  2718.         A subclass called FooWeight taking parameters param1 and param2 should
  2719.         implement this as:
  2720.  
  2721.         virtual FooWeight * clone() const { return new FooWeight(param1,
  2722.         param2); } 
  2723.         '''
  2724.         return _xapian.BM25Weight_clone(*args)
  2725.  
  2726.     __swig_destroy__ = _xapian.delete_BM25Weight
  2727.     
  2728.     def unserialise(*args):
  2729.         '''
  2730.         Create object given string serialisation returned by serialise().
  2731.  
  2732.         BM25Weight* Xapian::BM25Weight::unserialise(const std::string &s)
  2733.         const 
  2734.         '''
  2735.         return _xapian.BM25Weight_unserialise(*args)
  2736.  
  2737.  
  2738. BM25Weight.clone = new_instancemethod(_xapian.BM25Weight_clone, None, BM25Weight)
  2739. BM25Weight.unserialise = new_instancemethod(_xapian.BM25Weight_unserialise, None, BM25Weight)
  2740. BM25Weight_swigregister = _xapian.BM25Weight_swigregister
  2741. BM25Weight_swigregister(BM25Weight)
  2742.  
  2743. class TradWeight(Weight):
  2744.     '''
  2745.     Traditional probabilistic weighting scheme.
  2746.  
  2747.     This class implements the Traditional Probabilistic Weighting scheme,
  2748.     as described by the early papers on Probabilistic Retrieval. BM25
  2749.     generally gives better results.
  2750.  
  2751.     The Traditional weighting scheme formula is \\[
  2752.     \\sum_{t}\\frac{f_{t,d}}{k.L_{d}+f_{t,d}}.w_{t} \\] where
  2753.     $w_{t}$ is the termweight of term t
  2754.  
  2755.     $f_{t,d}$ is the within document frequency of term t in document d
  2756.  
  2757.     $L_{d}$ is the normalised length of document d
  2758.  
  2759.     $k$ is a user specifiable parameter
  2760.  
  2761.     TradWeight(k) is equivalent to BM25Weight(k, 0, 0, 1, 0), except that
  2762.     the latter returns weights (k+1) times larger. 
  2763.     '''
  2764.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2765.     __repr__ = _swig_repr
  2766.     
  2767.     def __init__(self, *args):
  2768.         '''Xapian::TradWeight::TradWeight() '''
  2769.         _xapian.TradWeight_swiginit(self, _xapian.new_TradWeight(*args))
  2770.  
  2771.     
  2772.     def clone(*args):
  2773.         '''
  2774.         Return a new weight object of this type.
  2775.  
  2776.         TradWeight* Xapian::TradWeight::clone() const
  2777.  
  2778.         A subclass called FooWeight taking parameters param1 and param2 should
  2779.         implement this as:
  2780.  
  2781.         virtual FooWeight * clone() const { return new FooWeight(param1,
  2782.         param2); } 
  2783.         '''
  2784.         return _xapian.TradWeight_clone(*args)
  2785.  
  2786.     __swig_destroy__ = _xapian.delete_TradWeight
  2787.     
  2788.     def unserialise(*args):
  2789.         '''
  2790.         Create object given string serialisation returned by serialise().
  2791.  
  2792.         TradWeight* Xapian::TradWeight::unserialise(const std::string &s)
  2793.         const 
  2794.         '''
  2795.         return _xapian.TradWeight_unserialise(*args)
  2796.  
  2797.  
  2798. TradWeight.clone = new_instancemethod(_xapian.TradWeight_clone, None, TradWeight)
  2799. TradWeight.unserialise = new_instancemethod(_xapian.TradWeight_unserialise, None, TradWeight)
  2800. TradWeight_swigregister = _xapian.TradWeight_swigregister
  2801. TradWeight_swigregister(TradWeight)
  2802.  
  2803. class Database(object):
  2804.     '''
  2805.     This class is used to access a database, or a group of databases.
  2806.  
  2807.     For searching, this class is used in conjunction with an Enquire
  2808.     object.
  2809.  
  2810.     Parameters:
  2811.     -----------
  2812.  
  2813.     InvalidArgumentError:  will be thrown if an invalid argument is
  2814.     supplied, for example, an unknown database type.
  2815.  
  2816.     DatabaseOpeningError:  may be thrown if the database cannot be opened
  2817.     (for example, a required file cannot be found).
  2818.  
  2819.     DatabaseVersionError:  may be thrown if the database is in an
  2820.     unsupported format (for example, created by a newer version of Xapian
  2821.     which uses an incompatible format). 
  2822.     '''
  2823.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  2824.     __repr__ = _swig_repr
  2825.     
  2826.     def add_database(*args):
  2827.         '''
  2828.         Add an existing database (or group of databases) to those accessed by
  2829.         this object.
  2830.  
  2831.         void Xapian::Database::add_database(const Database &database)
  2832.  
  2833.         Parameters:
  2834.         -----------
  2835.  
  2836.         database:  the database(s) to add. 
  2837.         '''
  2838.         return _xapian.Database_add_database(*args)
  2839.  
  2840.     __swig_destroy__ = _xapian.delete_Database
  2841.     
  2842.     def __init__(self, *args):
  2843.         '''
  2844.         Copying is allowed.
  2845.  
  2846.         Xapian::Database::Database(const Database &other)
  2847.  
  2848.         The internals are reference counted, so copying is cheap. 
  2849.         '''
  2850.         _xapian.Database_swiginit(self, _xapian.new_Database(*args))
  2851.  
  2852.     
  2853.     def reopen(*args):
  2854.         '''
  2855.         Re-open the database.
  2856.  
  2857.         void Xapian::Database::reopen()
  2858.  
  2859.         This re-opens the database(s) to the latest available version(s). It
  2860.         can be used either to make sure the latest results are returned, or to
  2861.         recover from a Xapian::DatabaseModifiedError. 
  2862.         '''
  2863.         return _xapian.Database_reopen(*args)
  2864.  
  2865.     
  2866.     def __str__(*args):
  2867.         '''
  2868.         Return a string describing this object.
  2869.  
  2870.         virtual std::string Xapian::Database::get_description() const 
  2871.         '''
  2872.         return _xapian.Database___str__(*args)
  2873.  
  2874.     
  2875.     def postlist_begin(*args):
  2876.         '''
  2877.         An iterator pointing to the start of the postlist for a given term.
  2878.  
  2879.         PostingIterator Xapian::Database::postlist_begin(const std::string
  2880.         &tname) const
  2881.  
  2882.         If the term name is the empty string, the iterator returned will list
  2883.         all the documents in the database. Such an iterator will always return
  2884.         a WDF value of 1, since there is no obvious meaning for this quantity
  2885.         in this case. 
  2886.         '''
  2887.         return _xapian.Database_postlist_begin(*args)
  2888.  
  2889.     
  2890.     def postlist_end(*args):
  2891.         '''
  2892.         Corresponding end iterator to postlist_begin().
  2893.  
  2894.         PostingIterator Xapian::Database::postlist_end(const std::string &)
  2895.         const 
  2896.         '''
  2897.         return _xapian.Database_postlist_end(*args)
  2898.  
  2899.     
  2900.     def termlist_begin(*args):
  2901.         '''
  2902.         An iterator pointing to the start of the termlist for a given
  2903.         document.
  2904.  
  2905.         TermIterator Xapian::Database::termlist_begin(Xapian::docid did) const
  2906.  
  2907.         '''
  2908.         return _xapian.Database_termlist_begin(*args)
  2909.  
  2910.     
  2911.     def termlist_end(*args):
  2912.         '''
  2913.         Corresponding end iterator to termlist_begin().
  2914.  
  2915.         TermIterator Xapian::Database::termlist_end(Xapian::docid) const 
  2916.         '''
  2917.         return _xapian.Database_termlist_end(*args)
  2918.  
  2919.     
  2920.     def positionlist_begin(*args):
  2921.         '''
  2922.         An iterator pointing to the start of the position list for a given
  2923.         term in a given document.
  2924.  
  2925.         PositionIterator Xapian::Database::positionlist_begin(Xapian::docid
  2926.         did, const std::string &tname) const 
  2927.         '''
  2928.         return _xapian.Database_positionlist_begin(*args)
  2929.  
  2930.     
  2931.     def positionlist_end(*args):
  2932.         '''
  2933.         Corresponding end iterator to positionlist_begin().
  2934.  
  2935.         PositionIterator Xapian::Database::positionlist_end(Xapian::docid,
  2936.         const std::string &) const 
  2937.         '''
  2938.         return _xapian.Database_positionlist_end(*args)
  2939.  
  2940.     
  2941.     def allterms_begin(*args):
  2942.         '''
  2943.         An iterator which runs across all terms with a given prefix.
  2944.  
  2945.         TermIterator Xapian::Database::allterms_begin(const std::string
  2946.         &prefix) const
  2947.  
  2948.         This is functionally similar to getting an iterator with
  2949.         allterms_begin() and then calling skip_to(prefix) on that iterator to
  2950.         move to the start of the prefix, but is more convenient (because it
  2951.         detects the end of the prefixed terms), and may be more efficient than
  2952.         simply calling skip_to() after opening the iterator, particularly for
  2953.         network databases.
  2954.  
  2955.         Parameters:
  2956.         -----------
  2957.  
  2958.         prefix:  The prefix to restrict the returned terms to. 
  2959.         '''
  2960.         return _xapian.Database_allterms_begin(*args)
  2961.  
  2962.     
  2963.     def allterms_end(*args):
  2964.         '''
  2965.         Corresponding end iterator to allterms_begin(prefix).
  2966.  
  2967.         TermIterator Xapian::Database::allterms_end(const std::string &) const
  2968.  
  2969.         '''
  2970.         return _xapian.Database_allterms_end(*args)
  2971.  
  2972.     
  2973.     def get_doccount(*args):
  2974.         '''
  2975.         Get the number of documents in the database.
  2976.  
  2977.         Xapian::doccount Xapian::Database::get_doccount() const 
  2978.         '''
  2979.         return _xapian.Database_get_doccount(*args)
  2980.  
  2981.     
  2982.     def get_lastdocid(*args):
  2983.         '''
  2984.         Get the highest document id which has been used in the database.
  2985.  
  2986.         Xapian::docid Xapian::Database::get_lastdocid() const 
  2987.         '''
  2988.         return _xapian.Database_get_lastdocid(*args)
  2989.  
  2990.     
  2991.     def get_avlength(*args):
  2992.         '''
  2993.         Get the average length of the documents in the database.
  2994.  
  2995.         Xapian::doclength Xapian::Database::get_avlength() const 
  2996.         '''
  2997.         return _xapian.Database_get_avlength(*args)
  2998.  
  2999.     
  3000.     def get_termfreq(*args):
  3001.         '''
  3002.         Get the number of documents in the database indexed by a given term.
  3003.  
  3004.         Xapian::doccount Xapian::Database::get_termfreq(const std::string
  3005.         &tname) const 
  3006.         '''
  3007.         return _xapian.Database_get_termfreq(*args)
  3008.  
  3009.     
  3010.     def term_exists(*args):
  3011.         '''
  3012.         Check if a given term exists in the database.
  3013.  
  3014.         bool Xapian::Database::term_exists(const std::string &tname) const
  3015.  
  3016.         Return true if and only if the term exists in the database. This is
  3017.         the same as (get_termfreq(tname) != 0), but will often be more
  3018.         efficient. 
  3019.         '''
  3020.         return _xapian.Database_term_exists(*args)
  3021.  
  3022.     
  3023.     def get_collection_freq(*args):
  3024.         '''
  3025.         Return the total number of occurrences of the given term.
  3026.  
  3027.         Xapian::termcount Xapian::Database::get_collection_freq(const
  3028.         std::string &tname) const
  3029.  
  3030.         This is the sum of the number of occurrences of the term in each
  3031.         document it indexes: i.e., the sum of the within document frequencies
  3032.         of the term.
  3033.  
  3034.         Parameters:
  3035.         -----------
  3036.  
  3037.         tname:  The term whose collection frequency is being requested. 
  3038.         '''
  3039.         return _xapian.Database_get_collection_freq(*args)
  3040.  
  3041.     
  3042.     def get_doclength(*args):
  3043.         '''
  3044.         Get the length of a document.
  3045.  
  3046.         Xapian::doclength Xapian::Database::get_doclength(Xapian::docid did)
  3047.         const 
  3048.         '''
  3049.         return _xapian.Database_get_doclength(*args)
  3050.  
  3051.     
  3052.     def keep_alive(*args):
  3053.         '''
  3054.         Send a "keep-alive" to remote databases to stop them timing out.
  3055.  
  3056.         void Xapian::Database::keep_alive() 
  3057.         '''
  3058.         return _xapian.Database_keep_alive(*args)
  3059.  
  3060.     
  3061.     def get_document(*args):
  3062.         '''
  3063.         Get a document from the database, given its document id.
  3064.  
  3065.         Xapian::Document Xapian::Database::get_document(Xapian::docid did)
  3066.         const
  3067.  
  3068.         This method returns a Xapian::Document object which provides the
  3069.         information about a document.
  3070.  
  3071.         Parameters:
  3072.         -----------
  3073.  
  3074.         did:  The document id for which to retrieve the data.
  3075.  
  3076.         A Xapian::Document object containing the document data
  3077.  
  3078.         Parameters:
  3079.         -----------
  3080.  
  3081.         Xapian::DocNotFoundError:  The document specified could not be found
  3082.         in the database. 
  3083.         '''
  3084.         return _xapian.Database_get_document(*args)
  3085.  
  3086.     
  3087.     def get_spelling_suggestion(*args):
  3088.         '''
  3089.         Suggest a spelling correction.
  3090.  
  3091.         std::string Xapian::Database::get_spelling_suggestion(const
  3092.         std::string &word, unsigned max_edit_distance=2) const
  3093.  
  3094.         Parameters:
  3095.         -----------
  3096.  
  3097.         word:  The potentially misspelled word.
  3098.  
  3099.         max_edit_distance:  Only consider words which are at most
  3100.         max_edit_distance edits from word. An edit is a character insertion,
  3101.         deletion, or the transposition of two adjacent characters (default is
  3102.         2). 
  3103.         '''
  3104.         return _xapian.Database_get_spelling_suggestion(*args)
  3105.  
  3106.     
  3107.     def spellings_begin(*args):
  3108.         '''
  3109.         An iterator which returns all the spelling correction targets.
  3110.  
  3111.         Xapian::TermIterator Xapian::Database::spellings_begin() const
  3112.  
  3113.         This returns all the words which are considered as targets for the
  3114.         spelling correction algorithm. The frequency of each word is available
  3115.         as the term frequency of each entry in the returned iterator. 
  3116.         '''
  3117.         return _xapian.Database_spellings_begin(*args)
  3118.  
  3119.     
  3120.     def spellings_end(*args):
  3121.         '''
  3122.         Corresponding end iterator to spellings_begin().
  3123.  
  3124.         Xapian::TermIterator Xapian::Database::spellings_end() const 
  3125.         '''
  3126.         return _xapian.Database_spellings_end(*args)
  3127.  
  3128.     
  3129.     def synonyms_begin(*args):
  3130.         '''
  3131.         An iterator which returns all the synonyms for a given term.
  3132.  
  3133.         Xapian::TermIterator Xapian::Database::synonyms_begin(const
  3134.         std::string &term) const
  3135.  
  3136.         Parameters:
  3137.         -----------
  3138.  
  3139.         term:  The term to return synonyms for. 
  3140.         '''
  3141.         return _xapian.Database_synonyms_begin(*args)
  3142.  
  3143.     
  3144.     def synonyms_end(*args):
  3145.         '''
  3146.         Corresponding end iterator to synonyms_begin(term).
  3147.  
  3148.         Xapian::TermIterator Xapian::Database::synonyms_end(const std::string
  3149.         &) const 
  3150.         '''
  3151.         return _xapian.Database_synonyms_end(*args)
  3152.  
  3153.     
  3154.     def synonym_keys_begin(*args):
  3155.         '''
  3156.         An iterator which returns all terms which have synonyms.
  3157.  
  3158.         Xapian::TermIterator Xapian::Database::synonym_keys_begin(const
  3159.         std::string &prefix="") const
  3160.  
  3161.         Parameters:
  3162.         -----------
  3163.  
  3164.         prefix:  If non-empty, only terms with this prefix are returned. 
  3165.         '''
  3166.         return _xapian.Database_synonym_keys_begin(*args)
  3167.  
  3168.     
  3169.     def synonym_keys_end(*args):
  3170.         '''
  3171.         Corresponding end iterator to synonym_keys_begin(prefix).
  3172.  
  3173.         Xapian::TermIterator Xapian::Database::synonym_keys_end(const
  3174.         std::string &="") const 
  3175.         '''
  3176.         return _xapian.Database_synonym_keys_end(*args)
  3177.  
  3178.     
  3179.     def get_metadata(*args):
  3180.         """
  3181.         Get the user-specified metadata associated with a given key.
  3182.  
  3183.         std::string Xapian::Database::get_metadata(const std::string &key)
  3184.         const
  3185.  
  3186.         User-specified metadata allows you to store arbitrary information in
  3187.         the form of (key,tag) pairs. See  WritableDatabase::set_metadata() for
  3188.         more information.
  3189.  
  3190.         When invoked on a Xapian::Database object representing multiple
  3191.         databases, currently only the metadata for the first is considered but
  3192.         this behaviour may change in the future.
  3193.  
  3194.         If there is no piece of metadata associated with the specified key, an
  3195.         empty string is returned (this applies even for backends which don't
  3196.         support metadata).
  3197.  
  3198.         Empty keys are not valid, and specifying one will cause an exception.
  3199.  
  3200.         Parameters:
  3201.         -----------
  3202.  
  3203.         key:  The key of the metadata item to access.
  3204.  
  3205.         The retrieved metadata item's value.
  3206.  
  3207.         Parameters:
  3208.         -----------
  3209.  
  3210.         Xapian::InvalidArgumentError:  will be thrown if the key supplied is
  3211.         empty. 
  3212.         """
  3213.         return _xapian.Database_get_metadata(*args)
  3214.  
  3215.     
  3216.     def _metadata_keys_begin(*args):
  3217.         '''
  3218.         An iterator which returns all user-specified metadata keys.
  3219.  
  3220.         Xapian::TermIterator Xapian::Database::metadata_keys_begin(const
  3221.         std::string &prefix="") const
  3222.  
  3223.         When invoked on a Xapian::Database object representing multiple
  3224.         databases, currently only the metadata for the first is considered but
  3225.         this behaviour may change in the future.
  3226.  
  3227.         If the backend doesn\'t support metadata, then this method returns an
  3228.         iterator which compares equal to that returned by metadata_keys_end().
  3229.  
  3230.         Parameters:
  3231.         -----------
  3232.  
  3233.         prefix:  If non-empty, only keys with this prefix are returned.
  3234.  
  3235.         Parameters:
  3236.         -----------
  3237.  
  3238.         Xapian::UnimplementedError:  will be thrown if the backend implements
  3239.         user-specified metadata, but doesn\'t implement iterating its keys
  3240.         (currently this happens for the InMemory backend). 
  3241.         '''
  3242.         return _xapian.Database__metadata_keys_begin(*args)
  3243.  
  3244.     
  3245.     def _metadata_keys_end(*args):
  3246.         '''
  3247.         Corresponding end iterator to metadata_keys_begin().
  3248.  
  3249.         Xapian::TermIterator Xapian::Database::metadata_keys_end(const
  3250.         std::string &="") const 
  3251.         '''
  3252.         return _xapian.Database__metadata_keys_end(*args)
  3253.  
  3254.     
  3255.     def get_description(*args):
  3256.         '''
  3257.         Return a string describing this object.
  3258.  
  3259.         virtual std::string Xapian::Database::get_description() const 
  3260.         '''
  3261.         return _xapian.Database_get_description(*args)
  3262.  
  3263.  
  3264. Database.add_database = new_instancemethod(_xapian.Database_add_database, None, Database)
  3265. Database.reopen = new_instancemethod(_xapian.Database_reopen, None, Database)
  3266. Database.__str__ = new_instancemethod(_xapian.Database___str__, None, Database)
  3267. Database.postlist_begin = new_instancemethod(_xapian.Database_postlist_begin, None, Database)
  3268. Database.postlist_end = new_instancemethod(_xapian.Database_postlist_end, None, Database)
  3269. Database.termlist_begin = new_instancemethod(_xapian.Database_termlist_begin, None, Database)
  3270. Database.termlist_end = new_instancemethod(_xapian.Database_termlist_end, None, Database)
  3271. Database.positionlist_begin = new_instancemethod(_xapian.Database_positionlist_begin, None, Database)
  3272. Database.positionlist_end = new_instancemethod(_xapian.Database_positionlist_end, None, Database)
  3273. Database.allterms_begin = new_instancemethod(_xapian.Database_allterms_begin, None, Database)
  3274. Database.allterms_end = new_instancemethod(_xapian.Database_allterms_end, None, Database)
  3275. Database.get_doccount = new_instancemethod(_xapian.Database_get_doccount, None, Database)
  3276. Database.get_lastdocid = new_instancemethod(_xapian.Database_get_lastdocid, None, Database)
  3277. Database.get_avlength = new_instancemethod(_xapian.Database_get_avlength, None, Database)
  3278. Database.get_termfreq = new_instancemethod(_xapian.Database_get_termfreq, None, Database)
  3279. Database.term_exists = new_instancemethod(_xapian.Database_term_exists, None, Database)
  3280. Database.get_collection_freq = new_instancemethod(_xapian.Database_get_collection_freq, None, Database)
  3281. Database.get_doclength = new_instancemethod(_xapian.Database_get_doclength, None, Database)
  3282. Database.keep_alive = new_instancemethod(_xapian.Database_keep_alive, None, Database)
  3283. Database.get_document = new_instancemethod(_xapian.Database_get_document, None, Database)
  3284. Database.get_spelling_suggestion = new_instancemethod(_xapian.Database_get_spelling_suggestion, None, Database)
  3285. Database.spellings_begin = new_instancemethod(_xapian.Database_spellings_begin, None, Database)
  3286. Database.spellings_end = new_instancemethod(_xapian.Database_spellings_end, None, Database)
  3287. Database.synonyms_begin = new_instancemethod(_xapian.Database_synonyms_begin, None, Database)
  3288. Database.synonyms_end = new_instancemethod(_xapian.Database_synonyms_end, None, Database)
  3289. Database.synonym_keys_begin = new_instancemethod(_xapian.Database_synonym_keys_begin, None, Database)
  3290. Database.synonym_keys_end = new_instancemethod(_xapian.Database_synonym_keys_end, None, Database)
  3291. Database.get_metadata = new_instancemethod(_xapian.Database_get_metadata, None, Database)
  3292. Database._metadata_keys_begin = new_instancemethod(_xapian.Database__metadata_keys_begin, None, Database)
  3293. Database._metadata_keys_end = new_instancemethod(_xapian.Database__metadata_keys_end, None, Database)
  3294. Database.get_description = new_instancemethod(_xapian.Database_get_description, None, Database)
  3295. Database_swigregister = _xapian.Database_swigregister
  3296. Database_swigregister(Database)
  3297.  
  3298. class WritableDatabase(Database):
  3299.     '''
  3300.     This class provides read/write access to a database. 
  3301.     '''
  3302.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  3303.     __repr__ = _swig_repr
  3304.     __swig_destroy__ = _xapian.delete_WritableDatabase
  3305.     
  3306.     def __init__(self, *args):
  3307.         '''
  3308.         Copying is allowed.
  3309.  
  3310.         Xapian::WritableDatabase::WritableDatabase(const WritableDatabase
  3311.         &other)
  3312.  
  3313.         The internals are reference counted, so copying is cheap. 
  3314.         '''
  3315.         _xapian.WritableDatabase_swiginit(self, _xapian.new_WritableDatabase(*args))
  3316.  
  3317.     
  3318.     def flush(*args):
  3319.         """
  3320.         Flush to disk any modifications made to the database.
  3321.  
  3322.         void Xapian::WritableDatabase::flush()
  3323.  
  3324.         For efficiency reasons, when performing multiple updates to a database
  3325.         it is best (indeed, almost essential) to make as many modifications as
  3326.         memory will permit in a single pass through the database. To ensure
  3327.         this, Xapian batches up modifications.
  3328.  
  3329.         Flush may be called at any time to ensure that the modifications which
  3330.         have been made are written to disk: if the flush succeeds, all the
  3331.         preceding modifications will have been written to disk.
  3332.  
  3333.         If any of the modifications fail, an exception will be thrown and the
  3334.         database will be left in a state in which each separate addition,
  3335.         replacement or deletion operation has either been fully performed or
  3336.         not performed at all: it is then up to the application to work out
  3337.         which operations need to be repeated.
  3338.  
  3339.         It's not valid to call flush within a transaction.
  3340.  
  3341.         Beware of calling flush too frequently: this will have a severe
  3342.         performance cost.
  3343.  
  3344.         Note that flush need not be called explicitly: it will be called
  3345.         automatically when the database is closed, or when a sufficient number
  3346.         of modifications have been made. By default, this is every 10000
  3347.         documents added, deleted, or modified. This value is rather
  3348.         conservative, and if you have a machine with plenty of memory, you can
  3349.         improve indexing throughput dramatically by setting
  3350.         XAPIAN_FLUSH_THRESHOLD in the environment to a larger value.
  3351.  
  3352.         Parameters:
  3353.         -----------
  3354.  
  3355.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3356.         modifying the database.
  3357.  
  3358.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3359.         corrupt state. 
  3360.         """
  3361.         return _xapian.WritableDatabase_flush(*args)
  3362.  
  3363.     
  3364.     def begin_transaction(*args):
  3365.         """
  3366.         Begin a transaction.
  3367.  
  3368.         void Xapian::WritableDatabase::begin_transaction(bool flushed=true)
  3369.  
  3370.         In Xapian a transaction is a group of modifications to the database
  3371.         which are linked such that either all will be applied simultaneously
  3372.         or none will be applied at all. Even in the case of a power failure,
  3373.         this characteristic should be preserved (as long as the filesystem
  3374.         isn't corrupted, etc).
  3375.  
  3376.         A transaction is started with begin_transaction() and can either be
  3377.         committed by calling commit_transaction() or aborted by calling
  3378.         cancel_transaction().
  3379.  
  3380.         By default, a transaction implicitly calls flush before and after so
  3381.         that the modifications stand and fall without affecting modifications
  3382.         before or after.
  3383.  
  3384.         The downside of this flushing is that small transactions cause
  3385.         modifications to be frequently flushed which can harm indexing
  3386.         performance in the same way that explicitly calling flush frequently
  3387.         can.
  3388.  
  3389.         If you're applying atomic groups of changes and only wish to ensure
  3390.         that each group is either applied or not applied, then you can prevent
  3391.         the automatic flush before and after the transaction by starting the
  3392.         transaction with begin_transaction(false). However, if
  3393.         cancel_transaction is called (or if commit_transaction isn't called
  3394.         before the WritableDatabase object is destroyed) then any changes
  3395.         which were pending before the transaction began will also be
  3396.         discarded.
  3397.  
  3398.         Transactions aren't currently supported by the InMemory backend.
  3399.  
  3400.         Parameters:
  3401.         -----------
  3402.  
  3403.         Xapian::UnimplementedError:  will be thrown if transactions are not
  3404.         available for this database type.
  3405.  
  3406.         Xapian::InvalidOperationError:  will be thrown if this is called at an
  3407.         invalid time, such as when a transaction is already in progress. 
  3408.         """
  3409.         return _xapian.WritableDatabase_begin_transaction(*args)
  3410.  
  3411.     
  3412.     def commit_transaction(*args):
  3413.         '''
  3414.         Complete the transaction currently in progress.
  3415.  
  3416.         void Xapian::WritableDatabase::commit_transaction()
  3417.  
  3418.         If this method completes successfully and this is a flushed
  3419.         transaction, all the database modifications made during the
  3420.         transaction will have been committed to the database.
  3421.  
  3422.         If an error occurs, an exception will be thrown, and none of the
  3423.         modifications made to the database during the transaction will have
  3424.         been applied to the database.
  3425.  
  3426.         In all cases the transaction will no longer be in progress.
  3427.  
  3428.         Parameters:
  3429.         -----------
  3430.  
  3431.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3432.         modifying the database.
  3433.  
  3434.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3435.         corrupt state.
  3436.  
  3437.         Xapian::InvalidOperationError:  will be thrown if a transaction is not
  3438.         currently in progress.
  3439.  
  3440.         Xapian::UnimplementedError:  will be thrown if transactions are not
  3441.         available for this database type. 
  3442.         '''
  3443.         return _xapian.WritableDatabase_commit_transaction(*args)
  3444.  
  3445.     
  3446.     def cancel_transaction(*args):
  3447.         '''
  3448.         Abort the transaction currently in progress, discarding the potential
  3449.         modifications made to the database.
  3450.  
  3451.         void Xapian::WritableDatabase::cancel_transaction()
  3452.  
  3453.         If an error occurs in this method, an exception will be thrown, but
  3454.         the transaction will be cancelled anyway.
  3455.  
  3456.         Parameters:
  3457.         -----------
  3458.  
  3459.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3460.         modifying the database.
  3461.  
  3462.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3463.         corrupt state.
  3464.  
  3465.         Xapian::InvalidOperationError:  will be thrown if a transaction is not
  3466.         currently in progress.
  3467.  
  3468.         Xapian::UnimplementedError:  will be thrown if transactions are not
  3469.         available for this database type. 
  3470.         '''
  3471.         return _xapian.WritableDatabase_cancel_transaction(*args)
  3472.  
  3473.     
  3474.     def add_document(*args):
  3475.         """
  3476.         Add a new document to the database.
  3477.  
  3478.         Xapian::docid Xapian::WritableDatabase::add_document(const
  3479.         Xapian::Document &document)
  3480.  
  3481.         This method adds the specified document to the database, returning a
  3482.         newly allocated document ID. Automatically allocated document IDs come
  3483.         from a per-database monotonically increasing counter, so IDs from
  3484.         deleted documents won't be reused.
  3485.  
  3486.         If you want to specify the document ID to be used, you should call
  3487.         replace_document() instead.
  3488.  
  3489.         Note that changes to the database won't be immediately committed to
  3490.         disk; see flush() for more details.
  3491.  
  3492.         As with all database modification operations, the effect is atomic:
  3493.         the document will either be fully added, or the document fails to be
  3494.         added and an exception is thrown (possibly at a later time when flush
  3495.         is called or the database is closed).
  3496.  
  3497.         Parameters:
  3498.         -----------
  3499.  
  3500.         document:  The new document to be added.
  3501.  
  3502.         The document ID of the newly added document.
  3503.  
  3504.         Parameters:
  3505.         -----------
  3506.  
  3507.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3508.         writing to the database.
  3509.  
  3510.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3511.         corrupt state. 
  3512.         """
  3513.         return _xapian.WritableDatabase_add_document(*args)
  3514.  
  3515.     
  3516.     def delete_document(*args):
  3517.         '''
  3518.         Delete any documents indexed by a term from the database.
  3519.  
  3520.         void Xapian::WritableDatabase::delete_document(const std::string
  3521.         &unique_term)
  3522.  
  3523.         This method removes any documents indexed by the specified term from
  3524.         the database.
  3525.  
  3526.         A major use is for convenience when UIDs from another system are
  3527.         mapped to terms in Xapian, although this method has other uses (for
  3528.         example, you could add a "deletion date" term to documents at index
  3529.         time and use this method to delete all documents due for deletion on a
  3530.         particular date).
  3531.  
  3532.         Parameters:
  3533.         -----------
  3534.  
  3535.         unique_term:  The term to remove references to.
  3536.  
  3537.         Parameters:
  3538.         -----------
  3539.  
  3540.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3541.         writing to the database.
  3542.  
  3543.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3544.         corrupt state. 
  3545.         '''
  3546.         return _xapian.WritableDatabase_delete_document(*args)
  3547.  
  3548.     
  3549.     def replace_document(*args):
  3550.         '''
  3551.         Replace any documents matching a term.
  3552.  
  3553.         Xapian::docid Xapian::WritableDatabase::replace_document(const
  3554.         std::string &unique_term, const Xapian::Document &document)
  3555.  
  3556.         This method replaces any documents indexed by the specified term with
  3557.         the specified document. If any documents are indexed by the term, the
  3558.         lowest document ID will be used for the document, otherwise a new
  3559.         document ID will be generated as for add_document.
  3560.  
  3561.         A major use is for convenience when UIDs from another system are
  3562.         mapped to terms in Xapian, although this method has other uses (for
  3563.         example, you could add a "deletion date" term to documents at index
  3564.         time and use this method to delete all documents due for deletion on a
  3565.         particular date).
  3566.  
  3567.         Note that changes to the database won\'t be immediately committed to
  3568.         disk; see flush() for more details.
  3569.  
  3570.         As with all database modification operations, the effect is atomic:
  3571.         the document(s) will either be fully replaced, or the document(s) fail
  3572.         to be replaced and an exception is thrown (possibly at a later time
  3573.         when flush is called or the database is closed).
  3574.  
  3575.         Parameters:
  3576.         -----------
  3577.  
  3578.         unique_term:  The "unique" term.
  3579.  
  3580.         document:  The new document.
  3581.  
  3582.         The document ID that document was given.
  3583.  
  3584.         Parameters:
  3585.         -----------
  3586.  
  3587.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3588.         writing to the database.
  3589.  
  3590.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3591.         corrupt state. 
  3592.         '''
  3593.         return _xapian.WritableDatabase_replace_document(*args)
  3594.  
  3595.     
  3596.     def add_spelling(*args):
  3597.         '''
  3598.         Add a word to the spelling dictionary.
  3599.  
  3600.         void Xapian::WritableDatabase::add_spelling(const std::string &word,
  3601.         Xapian::termcount freqinc=1) const
  3602.  
  3603.         If the word is already present, its frequency is increased.
  3604.  
  3605.         Parameters:
  3606.         -----------
  3607.  
  3608.         word:  The word to add.
  3609.  
  3610.         freqinc:  How much to increase its frequency by (default 1). 
  3611.         '''
  3612.         return _xapian.WritableDatabase_add_spelling(*args)
  3613.  
  3614.     
  3615.     def remove_spelling(*args):
  3616.         """
  3617.         Remove a word from the spelling dictionary.
  3618.  
  3619.         void Xapian::WritableDatabase::remove_spelling(const std::string
  3620.         &word, Xapian::termcount freqdec=1) const
  3621.  
  3622.         The word's frequency is decreased, and if would become zero or less
  3623.         then the word is removed completely.
  3624.  
  3625.         Parameters:
  3626.         -----------
  3627.  
  3628.         word:  The word to remove.
  3629.  
  3630.         freqdec:  How much to decrease its frequency by (default 1). 
  3631.         """
  3632.         return _xapian.WritableDatabase_remove_spelling(*args)
  3633.  
  3634.     
  3635.     def add_synonym(*args):
  3636.         '''
  3637.         Add a synonym for a term.
  3638.  
  3639.         void Xapian::WritableDatabase::add_synonym(const std::string &term,
  3640.         const std::string &synonym) const
  3641.  
  3642.         If synonym is already a synonym for term, then no action is taken. 
  3643.         '''
  3644.         return _xapian.WritableDatabase_add_synonym(*args)
  3645.  
  3646.     
  3647.     def remove_synonym(*args):
  3648.         """
  3649.         Remove a synonym for a term.
  3650.  
  3651.         void Xapian::WritableDatabase::remove_synonym(const std::string &term,
  3652.         const std::string &synonym) const
  3653.  
  3654.         If synonym isn't a synonym for term, then no action is taken. 
  3655.         """
  3656.         return _xapian.WritableDatabase_remove_synonym(*args)
  3657.  
  3658.     
  3659.     def clear_synonyms(*args):
  3660.         '''
  3661.         Remove all synonyms for a term.
  3662.  
  3663.         void Xapian::WritableDatabase::clear_synonyms(const std::string &term)
  3664.         const
  3665.  
  3666.         If term has no synonyms, no action is taken. 
  3667.         '''
  3668.         return _xapian.WritableDatabase_clear_synonyms(*args)
  3669.  
  3670.     
  3671.     def set_metadata(*args):
  3672.         """
  3673.         Set the user-specified metadata associated with a given key.
  3674.  
  3675.         void Xapian::WritableDatabase::set_metadata(const std::string &key,
  3676.         const std::string &value)
  3677.  
  3678.         This method sets the metadata value associated with a given key. If
  3679.         there is already a metadata value stored in the database with the same
  3680.         key, the old value is replaced. If you want to delete an existing item
  3681.         of metadata, just set its value to the empty string.
  3682.  
  3683.         User-specified metadata allows you to store arbitrary information in
  3684.         the form of (key,tag) pairs.
  3685.  
  3686.         There's no hard limit on the number of metadata items, or the size of
  3687.         the metadata values. Metadata keys have a limited length, which
  3688.         depends on the backend. We recommend limiting them to 200 bytes. Empty
  3689.         keys are not valid, and specifying one will cause an exception.
  3690.  
  3691.         Metadata modifications are committed to disk in the same way as
  3692.         modifications to the documents in the database are: i.e.,
  3693.         modifications are atomic, and won't be committed to disk immediately
  3694.         (see flush() for more details). This allows metadata to be used to
  3695.         link databases with versioned external resources by storing the
  3696.         appropriate version number in a metadata item.
  3697.  
  3698.         You can also use the metadata to store arbitrary extra information
  3699.         associated with terms, documents, or postings by encoding the termname
  3700.         and/or document id into the metadata key.
  3701.  
  3702.         Parameters:
  3703.         -----------
  3704.  
  3705.         key:  The key of the metadata item to set.
  3706.  
  3707.         value:  The value of the metadata item to set.
  3708.  
  3709.         Parameters:
  3710.         -----------
  3711.  
  3712.         Xapian::DatabaseError:  will be thrown if a problem occurs while
  3713.         writing to the database.
  3714.  
  3715.         Xapian::DatabaseCorruptError:  will be thrown if the database is in a
  3716.         corrupt state.
  3717.  
  3718.         Xapian::InvalidArgumentError:  will be thrown if the key supplied is
  3719.         empty.
  3720.  
  3721.         Xapian::UnimplementedError:  will be thrown if the database backend in
  3722.         use doesn't support user- specified metadata. 
  3723.         """
  3724.         return _xapian.WritableDatabase_set_metadata(*args)
  3725.  
  3726.     
  3727.     def __str__(*args):
  3728.         '''
  3729.         Return a string describing this object.
  3730.  
  3731.         std::string Xapian::WritableDatabase::get_description() const 
  3732.         '''
  3733.         return _xapian.WritableDatabase___str__(*args)
  3734.  
  3735.     
  3736.     def get_description(*args):
  3737.         '''
  3738.         Return a string describing this object.
  3739.  
  3740.         std::string Xapian::WritableDatabase::get_description() const 
  3741.         '''
  3742.         return _xapian.WritableDatabase_get_description(*args)
  3743.  
  3744.  
  3745. WritableDatabase.flush = new_instancemethod(_xapian.WritableDatabase_flush, None, WritableDatabase)
  3746. WritableDatabase.begin_transaction = new_instancemethod(_xapian.WritableDatabase_begin_transaction, None, WritableDatabase)
  3747. WritableDatabase.commit_transaction = new_instancemethod(_xapian.WritableDatabase_commit_transaction, None, WritableDatabase)
  3748. WritableDatabase.cancel_transaction = new_instancemethod(_xapian.WritableDatabase_cancel_transaction, None, WritableDatabase)
  3749. WritableDatabase.add_document = new_instancemethod(_xapian.WritableDatabase_add_document, None, WritableDatabase)
  3750. WritableDatabase.delete_document = new_instancemethod(_xapian.WritableDatabase_delete_document, None, WritableDatabase)
  3751. WritableDatabase.replace_document = new_instancemethod(_xapian.WritableDatabase_replace_document, None, WritableDatabase)
  3752. WritableDatabase.add_spelling = new_instancemethod(_xapian.WritableDatabase_add_spelling, None, WritableDatabase)
  3753. WritableDatabase.remove_spelling = new_instancemethod(_xapian.WritableDatabase_remove_spelling, None, WritableDatabase)
  3754. WritableDatabase.add_synonym = new_instancemethod(_xapian.WritableDatabase_add_synonym, None, WritableDatabase)
  3755. WritableDatabase.remove_synonym = new_instancemethod(_xapian.WritableDatabase_remove_synonym, None, WritableDatabase)
  3756. WritableDatabase.clear_synonyms = new_instancemethod(_xapian.WritableDatabase_clear_synonyms, None, WritableDatabase)
  3757. WritableDatabase.set_metadata = new_instancemethod(_xapian.WritableDatabase_set_metadata, None, WritableDatabase)
  3758. WritableDatabase.__str__ = new_instancemethod(_xapian.WritableDatabase___str__, None, WritableDatabase)
  3759. WritableDatabase.get_description = new_instancemethod(_xapian.WritableDatabase_get_description, None, WritableDatabase)
  3760. WritableDatabase_swigregister = _xapian.WritableDatabase_swigregister
  3761. WritableDatabase_swigregister(WritableDatabase)
  3762. DB_CREATE_OR_OPEN = _xapian.DB_CREATE_OR_OPEN
  3763. DB_CREATE = _xapian.DB_CREATE
  3764. DB_CREATE_OR_OVERWRITE = _xapian.DB_CREATE_OR_OVERWRITE
  3765. DB_OPEN = _xapian.DB_OPEN
  3766.  
  3767. def open_stub(*args):
  3768.     '''
  3769.     Construct a Database object for a stub database file.
  3770.  
  3771.     XAPIAN_VISIBILITY_DEFAULT Database Xapian::Auto::open_stub(const
  3772.     std::string &file)
  3773.  
  3774.     The stub database file contains serialised parameters for one or more
  3775.     databases.
  3776.  
  3777.     Parameters:
  3778.     -----------
  3779.  
  3780.     file:  pathname of the stub database file. 
  3781.     '''
  3782.     return _xapian.open_stub(*args)
  3783.  
  3784.  
  3785. def inmemory_open(*args):
  3786.     '''
  3787.     Construct a WritableDatabase object for a new, empty InMemory
  3788.     database.
  3789.  
  3790.     XAPIAN_VISIBILITY_DEFAULT WritableDatabase Xapian::InMemory::open()
  3791.  
  3792.     Only a writable InMemory database can be created, since a read-only
  3793.     one would always remain empty. 
  3794.     '''
  3795.     return _xapian.inmemory_open(*args)
  3796.  
  3797.  
  3798. class Query(object):
  3799.     '''
  3800.     Class representing a query.
  3801.  
  3802.     Queries are represented as a tree of objects. 
  3803.     '''
  3804.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  3805.     __repr__ = _swig_repr
  3806.     OP_AND = _xapian.Query_OP_AND
  3807.     OP_OR = _xapian.Query_OP_OR
  3808.     OP_AND_NOT = _xapian.Query_OP_AND_NOT
  3809.     OP_XOR = _xapian.Query_OP_XOR
  3810.     OP_AND_MAYBE = _xapian.Query_OP_AND_MAYBE
  3811.     OP_FILTER = _xapian.Query_OP_FILTER
  3812.     OP_NEAR = _xapian.Query_OP_NEAR
  3813.     OP_PHRASE = _xapian.Query_OP_PHRASE
  3814.     OP_VALUE_RANGE = _xapian.Query_OP_VALUE_RANGE
  3815.     OP_SCALE_WEIGHT = _xapian.Query_OP_SCALE_WEIGHT
  3816.     OP_ELITE_SET = _xapian.Query_OP_ELITE_SET
  3817.     OP_VALUE_GE = _xapian.Query_OP_VALUE_GE
  3818.     OP_VALUE_LE = _xapian.Query_OP_VALUE_LE
  3819.     
  3820.     def __init__(self, *args):
  3821.         '''
  3822.         Construct a value comparison query on a document value.
  3823.  
  3824.         Xapian::Query::Query(Query::op op_, Xapian::valueno valno, const
  3825.         std::string &value)
  3826.  
  3827.         This query matches those documents which have a value stored in the
  3828.         slot given by valno which compares, as specified by the operator, to
  3829.         value.
  3830.  
  3831.         Parameters:
  3832.         -----------
  3833.  
  3834.         op_:  The operator to use for the query. Currently, must be
  3835.         OP_VALUE_GE or OP_VALUE_LE.
  3836.  
  3837.         valno:  The slot number to get the value from.
  3838.  
  3839.         value:  The value to compare. 
  3840.         '''
  3841.         _xapian.Query_swiginit(self, _xapian.new_Query(*args))
  3842.  
  3843.     __swig_destroy__ = _xapian.delete_Query
  3844.     
  3845.     def get_length(*args):
  3846.         '''
  3847.         Get the length of the query, used by some ranking formulae.
  3848.  
  3849.         Xapian::termcount Xapian::Query::get_length() const
  3850.  
  3851.         This value is calculated automatically - if you want to override it
  3852.         you can pass a different value to Enquire::set_query(). 
  3853.         '''
  3854.         return _xapian.Query_get_length(*args)
  3855.  
  3856.     
  3857.     def get_terms_begin(*args):
  3858.         '''
  3859.         Return a Xapian::TermIterator returning all the terms in the query, in
  3860.         order of termpos.
  3861.  
  3862.         TermIterator Xapian::Query::get_terms_begin() const
  3863.  
  3864.         If multiple terms have the same term position, their order is
  3865.         unspecified. Duplicates (same term and termpos) will be removed. 
  3866.         '''
  3867.         return _xapian.Query_get_terms_begin(*args)
  3868.  
  3869.     
  3870.     def get_terms_end(*args):
  3871.         '''
  3872.         Return a Xapian::TermIterator to the end of the list of terms in the
  3873.         query.
  3874.  
  3875.         TermIterator Xapian::Query::get_terms_end() const 
  3876.         '''
  3877.         return _xapian.Query_get_terms_end(*args)
  3878.  
  3879.     
  3880.     def empty(*args):
  3881.         '''
  3882.         Test if the query is empty (i.e.
  3883.  
  3884.         bool Xapian::Query::empty() const
  3885.  
  3886.         was constructed using the default ctor or with an empty iterator
  3887.         ctor). 
  3888.         '''
  3889.         return _xapian.Query_empty(*args)
  3890.  
  3891.     
  3892.     def __str__(*args):
  3893.         '''
  3894.         Return a string describing this object.
  3895.  
  3896.         std::string Xapian::Query::get_description() const 
  3897.         '''
  3898.         return _xapian.Query___str__(*args)
  3899.  
  3900.     
  3901.     def get_description(*args):
  3902.         '''
  3903.         Return a string describing this object.
  3904.  
  3905.         std::string Xapian::Query::get_description() const 
  3906.         '''
  3907.         return _xapian.Query_get_description(*args)
  3908.  
  3909.  
  3910. Query.get_length = new_instancemethod(_xapian.Query_get_length, None, Query)
  3911. Query.get_terms_begin = new_instancemethod(_xapian.Query_get_terms_begin, None, Query)
  3912. Query.get_terms_end = new_instancemethod(_xapian.Query_get_terms_end, None, Query)
  3913. Query.empty = new_instancemethod(_xapian.Query_empty, None, Query)
  3914. Query.__str__ = new_instancemethod(_xapian.Query___str__, None, Query)
  3915. Query.get_description = new_instancemethod(_xapian.Query_get_description, None, Query)
  3916. Query_swigregister = _xapian.Query_swigregister
  3917. Query_swigregister(Query)
  3918. quartz_open = _xapian.quartz_open
  3919.  
  3920. def flint_open(*args):
  3921.     '''
  3922.     Construct a Database object for update access to a Flint database.
  3923.  
  3924.     XAPIAN_VISIBILITY_DEFAULT WritableDatabase Xapian::Flint::open(const
  3925.     std::string &dir, int action, int block_size=8192)
  3926.  
  3927.     Parameters:
  3928.     -----------
  3929.  
  3930.     dir:  pathname of the directory containing the database.
  3931.  
  3932.     action:  determines handling of existing/non-existing database:
  3933.     Xapian::DB_CREATE fail if database already exist, otherwise create new
  3934.     database.
  3935.  
  3936.     Xapian::DB_CREATE_OR_OPEN open existing database, or create new
  3937.     database if none exists.
  3938.  
  3939.     Xapian::DB_CREATE_OR_OVERWRITE overwrite existing database, or create
  3940.     new database if none exists.
  3941.  
  3942.     Xapian::DB_OPEN open existing database, failing if none exists.
  3943.  
  3944.     block_size:  the Btree blocksize to use (in bytes), which must be a
  3945.     power of two between 2048 and 65536 (inclusive). The default (also
  3946.     used if an invalid value if passed) is 8192 bytes. This parameter is
  3947.     ignored when opening an existing database. 
  3948.     '''
  3949.     return _xapian.flint_open(*args)
  3950.  
  3951.  
  3952. def remote_open(*args):
  3953.     """
  3954.     Construct a Database object for read-only access to a remote database
  3955.     accessed via a program.
  3956.  
  3957.     XAPIAN_VISIBILITY_DEFAULT Database Xapian::Remote::open(const
  3958.     std::string &program, const std::string &args, Xapian::timeout
  3959.     timeout=10000)
  3960.  
  3961.     Access to the remote database is done by running an external program
  3962.     and communicating with it on stdin/stdout.
  3963.  
  3964.     Parameters:
  3965.     -----------
  3966.  
  3967.     program:  the external program to run.
  3968.  
  3969.     args:  space-separated list of arguments to pass to program.
  3970.  
  3971.     timeout:  timeout in milliseconds. If this timeout is exceeded for any
  3972.     individual operation on the remote database then
  3973.     Xapian::NetworkTimeoutError is thrown. A timeout of 0 means don't
  3974.     timeout. (Default is 10000ms, which is 10 seconds). 
  3975.     """
  3976.     return _xapian.remote_open(*args)
  3977.  
  3978.  
  3979. def remote_open_writable(*args):
  3980.     """
  3981.     Construct a WritableDatabase object for update access to a remote
  3982.     database accessed via a program.
  3983.  
  3984.     XAPIAN_VISIBILITY_DEFAULT WritableDatabase
  3985.     Xapian::Remote::open_writable(const std::string &program, const
  3986.     std::string &args, Xapian::timeout timeout=0)
  3987.  
  3988.     Access to the remote database is done by running an external program
  3989.     and communicating with it on stdin/stdout.
  3990.  
  3991.     Parameters:
  3992.     -----------
  3993.  
  3994.     program:  the external program to run.
  3995.  
  3996.     args:  space-separated list of arguments to pass to program.
  3997.  
  3998.     timeout:  timeout in milliseconds. If this timeout is exceeded for any
  3999.     individual operation on the remote database then
  4000.     Xapian::NetworkTimeoutError is thrown. (Default is 0, which means
  4001.     don't timeout). 
  4002.     """
  4003.     return _xapian.remote_open_writable(*args)
  4004.  
  4005.  
  4006. class Stopper(object):
  4007.     '''
  4008.     Base class for stop-word decision functor. 
  4009.     '''
  4010.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4011.     __repr__ = _swig_repr
  4012.     __swig_destroy__ = _xapian.delete_Stopper
  4013.     
  4014.     def __str__(*args):
  4015.         '''
  4016.         Return a string describing this object.
  4017.  
  4018.         virtual std::string Xapian::Stopper::get_description() const 
  4019.         '''
  4020.         return _xapian.Stopper___str__(*args)
  4021.  
  4022.     
  4023.     def get_description(*args):
  4024.         '''
  4025.         Return a string describing this object.
  4026.  
  4027.         virtual std::string Xapian::Stopper::get_description() const 
  4028.         '''
  4029.         return _xapian.Stopper_get_description(*args)
  4030.  
  4031.     
  4032.     def __init__(self, *args):
  4033.         if self.__class__ == Stopper:
  4034.             args = (None,) + args
  4035.         else:
  4036.             args = (self,) + args
  4037.         _xapian.Stopper_swiginit(self, _xapian.new_Stopper(*args))
  4038.  
  4039.     
  4040.     def __disown__(self):
  4041.         self.this.disown()
  4042.         _xapian.disown_Stopper(self)
  4043.         return weakref_proxy(self)
  4044.  
  4045.  
  4046. Stopper.__call__ = new_instancemethod(_xapian.Stopper___call__, None, Stopper)
  4047. Stopper.__str__ = new_instancemethod(_xapian.Stopper___str__, None, Stopper)
  4048. Stopper.get_description = new_instancemethod(_xapian.Stopper_get_description, None, Stopper)
  4049. Stopper_swigregister = _xapian.Stopper_swigregister
  4050. Stopper_swigregister(Stopper)
  4051.  
  4052. class SimpleStopper(Stopper):
  4053.     '''
  4054.     Simple implementation of Stopper class - this will suit most users. 
  4055.     '''
  4056.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4057.     __repr__ = _swig_repr
  4058.     
  4059.     def __init__(self, *args):
  4060.         '''
  4061.         Initialise from a pair of iterators.
  4062.  
  4063.         Xapian::SimpleStopper::SimpleStopper(Iterator begin, Iterator end) 
  4064.         '''
  4065.         _xapian.SimpleStopper_swiginit(self, _xapian.new_SimpleStopper(*args))
  4066.  
  4067.     
  4068.     def add(*args):
  4069.         '''
  4070.         Add a single stop word.
  4071.  
  4072.         void Xapian::SimpleStopper::add(const std::string &word) 
  4073.         '''
  4074.         return _xapian.SimpleStopper_add(*args)
  4075.  
  4076.     __swig_destroy__ = _xapian.delete_SimpleStopper
  4077.  
  4078. SimpleStopper.add = new_instancemethod(_xapian.SimpleStopper_add, None, SimpleStopper)
  4079. SimpleStopper_swigregister = _xapian.SimpleStopper_swigregister
  4080. SimpleStopper_swigregister(SimpleStopper)
  4081.  
  4082. class ValueRangeProcessor(object):
  4083.     '''
  4084.     Base class for value range processors. 
  4085.     '''
  4086.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4087.     __repr__ = _swig_repr
  4088.     __swig_destroy__ = _xapian.delete_ValueRangeProcessor
  4089.     
  4090.     def __init__(self, *args):
  4091.         if self.__class__ == ValueRangeProcessor:
  4092.             args = (None,) + args
  4093.         else:
  4094.             args = (self,) + args
  4095.         _xapian.ValueRangeProcessor_swiginit(self, _xapian.new_ValueRangeProcessor(*args))
  4096.  
  4097.     
  4098.     def __disown__(self):
  4099.         self.this.disown()
  4100.         _xapian.disown_ValueRangeProcessor(self)
  4101.         return weakref_proxy(self)
  4102.  
  4103.  
  4104. ValueRangeProcessor.__call__ = new_instancemethod(_xapian.ValueRangeProcessor___call__, None, ValueRangeProcessor)
  4105. ValueRangeProcessor_swigregister = _xapian.ValueRangeProcessor_swigregister
  4106. ValueRangeProcessor_swigregister(ValueRangeProcessor)
  4107.  
  4108. class StringValueRangeProcessor(ValueRangeProcessor):
  4109.     '''
  4110.     Handle a string range.
  4111.  
  4112.     The end points can be any strings. 
  4113.     '''
  4114.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4115.     __repr__ = _swig_repr
  4116.     
  4117.     def __init__(self, *args):
  4118.         '''
  4119.         Constructor.
  4120.  
  4121.         Xapian::StringValueRangeProcessor::StringValueRangeProcessor(Xapian::v
  4122.         alueno valno_)
  4123.  
  4124.         Parameters:
  4125.         -----------
  4126.  
  4127.         valno_:  The value number to return from operator(). 
  4128.         '''
  4129.         _xapian.StringValueRangeProcessor_swiginit(self, _xapian.new_StringValueRangeProcessor(*args))
  4130.  
  4131.     __swig_destroy__ = _xapian.delete_StringValueRangeProcessor
  4132.  
  4133. StringValueRangeProcessor_swigregister = _xapian.StringValueRangeProcessor_swigregister
  4134. StringValueRangeProcessor_swigregister(StringValueRangeProcessor)
  4135.  
  4136. class DateValueRangeProcessor(ValueRangeProcessor):
  4137.     '''
  4138.     Handle a date range.
  4139.  
  4140.     Begin and end must be dates in a recognised format. 
  4141.     '''
  4142.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4143.     __repr__ = _swig_repr
  4144.     
  4145.     def __init__(self, *args):
  4146.         '''
  4147.         Constructor.
  4148.  
  4149.         Xapian::DateValueRangeProcessor::DateValueRangeProcessor(Xapian::value
  4150.         no valno_, bool prefer_mdy_=false, int epoch_year_=1970)
  4151.  
  4152.         Parameters:
  4153.         -----------
  4154.  
  4155.         valno_:  The value number to return from operator().
  4156.  
  4157.         prefer_mdy_:  Should ambiguous dates be interpreted as month/day/year
  4158.         rather than day/month/year? (default: false)
  4159.  
  4160.         epoch_year_:  Year to use as the epoch for dates with 2 digit years
  4161.         (default: 1970, so 1/1/69 is 2069 while 1/1/70 is 1970). 
  4162.         '''
  4163.         _xapian.DateValueRangeProcessor_swiginit(self, _xapian.new_DateValueRangeProcessor(*args))
  4164.  
  4165.     __swig_destroy__ = _xapian.delete_DateValueRangeProcessor
  4166.  
  4167. DateValueRangeProcessor_swigregister = _xapian.DateValueRangeProcessor_swigregister
  4168. DateValueRangeProcessor_swigregister(DateValueRangeProcessor)
  4169.  
  4170. class NumberValueRangeProcessor(ValueRangeProcessor):
  4171.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4172.     __repr__ = _swig_repr
  4173.     
  4174.     def __init__(self, *args):
  4175.         _xapian.NumberValueRangeProcessor_swiginit(self, _xapian.new_NumberValueRangeProcessor(*args))
  4176.  
  4177.     __swig_destroy__ = _xapian.delete_NumberValueRangeProcessor
  4178.  
  4179. NumberValueRangeProcessor_swigregister = _xapian.NumberValueRangeProcessor_swigregister
  4180. NumberValueRangeProcessor_swigregister(NumberValueRangeProcessor)
  4181.  
  4182. class QueryParser(object):
  4183.     '''
  4184.     Build a Xapian::Query object from a user query string. 
  4185.     '''
  4186.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4187.     __repr__ = _swig_repr
  4188.     FLAG_BOOLEAN = _xapian.QueryParser_FLAG_BOOLEAN
  4189.     FLAG_PHRASE = _xapian.QueryParser_FLAG_PHRASE
  4190.     FLAG_LOVEHATE = _xapian.QueryParser_FLAG_LOVEHATE
  4191.     FLAG_BOOLEAN_ANY_CASE = _xapian.QueryParser_FLAG_BOOLEAN_ANY_CASE
  4192.     FLAG_WILDCARD = _xapian.QueryParser_FLAG_WILDCARD
  4193.     FLAG_PURE_NOT = _xapian.QueryParser_FLAG_PURE_NOT
  4194.     FLAG_PARTIAL = _xapian.QueryParser_FLAG_PARTIAL
  4195.     FLAG_SPELLING_CORRECTION = _xapian.QueryParser_FLAG_SPELLING_CORRECTION
  4196.     FLAG_SYNONYM = _xapian.QueryParser_FLAG_SYNONYM
  4197.     FLAG_AUTO_SYNONYMS = _xapian.QueryParser_FLAG_AUTO_SYNONYMS
  4198.     FLAG_AUTO_MULTIWORD_SYNONYMS = _xapian.QueryParser_FLAG_AUTO_MULTIWORD_SYNONYMS
  4199.     FLAG_DEFAULT = _xapian.QueryParser_FLAG_DEFAULT
  4200.     STEM_NONE = _xapian.QueryParser_STEM_NONE
  4201.     STEM_SOME = _xapian.QueryParser_STEM_SOME
  4202.     STEM_ALL = _xapian.QueryParser_STEM_ALL
  4203.     
  4204.     def __init__(self, *args):
  4205.         '''
  4206.         Default constructor.
  4207.  
  4208.         Xapian::QueryParser::QueryParser() 
  4209.         '''
  4210.         _xapian.QueryParser_swiginit(self, _xapian.new_QueryParser(*args))
  4211.  
  4212.     __swig_destroy__ = _xapian.delete_QueryParser
  4213.     
  4214.     def set_stemmer(*args):
  4215.         '''
  4216.         Set the stemmer.
  4217.  
  4218.         void Xapian::QueryParser::set_stemmer(const Xapian::Stem &stemmer)
  4219.  
  4220.         This sets the stemming algorithm which will be used by the query
  4221.         parser. Note that the stemming algorithm will only be used according
  4222.         to the stemming strategy set by set_stemming_strategy(), which
  4223.         defaults to STEM_NONE. Therefore, to use a stemming algorithm, you
  4224.         will also need to call set_stemming_strategy() with a value other than
  4225.         STEM_NONE. 
  4226.         '''
  4227.         return _xapian.QueryParser_set_stemmer(*args)
  4228.  
  4229.     
  4230.     def set_stemming_strategy(*args):
  4231.         '''
  4232.         Set the stemming strategy.
  4233.  
  4234.         void Xapian::QueryParser::set_stemming_strategy(stem_strategy
  4235.         strategy)
  4236.  
  4237.         This controls how the query parser will apply the stemming algorithm.
  4238.         The default value is STEM_NONE. The possible values are:
  4239.  
  4240.         STEM_NONE: Don\'t perform any stemming.
  4241.  
  4242.         STEM_SOME: Search for stemmed forms of terms except for those which
  4243.         start with a capital letter, or are followed by certain characters
  4244.         (currently: (/@<>=*[{" ), or are used with operators which need
  4245.         positional information. Stemmed terms are prefixed with \'Z\'.
  4246.  
  4247.         STEM_ALL: Search for stemmed forms of all words (note: no \'Z\' prefix
  4248.         is added).
  4249.  
  4250.         Note that the stemming algorithm is only applied to words in
  4251.         probabilistic fields - boolean filter terms are never stemmed. 
  4252.         '''
  4253.         return _xapian.QueryParser_set_stemming_strategy(*args)
  4254.  
  4255.     
  4256.     def set_stopper(*args):
  4257.         '''
  4258.         Set the stopper.
  4259.  
  4260.         void Xapian::QueryParser::set_stopper(const Stopper *stop=NULL) 
  4261.         '''
  4262.         return _xapian.QueryParser_set_stopper(*args)
  4263.  
  4264.     
  4265.     def set_default_op(*args):
  4266.         '''
  4267.         Set the default boolean operator.
  4268.  
  4269.         void Xapian::QueryParser::set_default_op(Query::op default_op) 
  4270.         '''
  4271.         return _xapian.QueryParser_set_default_op(*args)
  4272.  
  4273.     
  4274.     def get_default_op(*args):
  4275.         '''
  4276.         Get the default boolean operator.
  4277.  
  4278.         Query::op Xapian::QueryParser::get_default_op() const 
  4279.         '''
  4280.         return _xapian.QueryParser_get_default_op(*args)
  4281.  
  4282.     
  4283.     def set_database(*args):
  4284.         '''
  4285.         Specify the database being searched.
  4286.  
  4287.         void Xapian::QueryParser::set_database(const Database &db) 
  4288.         '''
  4289.         return _xapian.QueryParser_set_database(*args)
  4290.  
  4291.     
  4292.     def parse_query(*args):
  4293.         '''
  4294.         Parse a query.
  4295.  
  4296.         Query Xapian::QueryParser::parse_query(const std::string
  4297.         &query_string, unsigned flags=FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE,
  4298.         const std::string &default_prefix="")
  4299.  
  4300.         Parameters:
  4301.         -----------
  4302.  
  4303.         query_string:  A free-text query as entered by a user
  4304.  
  4305.         flags:  Zero or more Query::feature_flag specifying what features the
  4306.         QueryParser should support. Combine multiple values with bitwise-or
  4307.         (|) (default FLAG_DEFAULT).
  4308.  
  4309.         default_prefix:  The default term prefix to use (default none). For
  4310.         example, you can pass "A" when parsing an "Author" field. 
  4311.         '''
  4312.         return _xapian.QueryParser_parse_query(*args)
  4313.  
  4314.     
  4315.     def add_prefix(*args):
  4316.         '''
  4317.         Add a probabilistic term prefix.
  4318.  
  4319.         void Xapian::QueryParser::add_prefix(const std::string &field, const
  4320.         std::string &prefix)
  4321.  
  4322.         For example:
  4323.  
  4324.         This allows the user to search for author:Orwell which will be
  4325.         converted to a search for the term "Aorwell".
  4326.  
  4327.         Multiple fields can be mapped to the same prefix. For example, you can
  4328.         make title: and subject: aliases for each other.
  4329.  
  4330.         As of 1.0.4, you can call this method multiple times with the same
  4331.         value of field to allow a single field to be mapped to multiple
  4332.         prefixes. Multiple terms being generated for such a field, and
  4333.         combined with  Xapian::Query::OP_OR.
  4334.  
  4335.         If any prefixes are specified for the empty field name (i.e. you call
  4336.         this method with an empty string as the first parameter) these
  4337.         prefixes will be used as the default prefix. If you do this and also
  4338.         specify the default_prefix parameter to  parse_query(), then the
  4339.         default_prefix parameter will override.
  4340.  
  4341.         If you call  add_prefix() and  add_boolean_prefix() for the same value
  4342.         of field, a Xapian::InvalidOperationError exception will be thrown.
  4343.  
  4344.         In 1.0.3 and earlier, subsequent calls to this method with the same
  4345.         value of field had no effect.
  4346.  
  4347.         Parameters:
  4348.         -----------
  4349.  
  4350.         field:  The user visible field name
  4351.  
  4352.         prefix:  The term prefix to map this to 
  4353.         '''
  4354.         return _xapian.QueryParser_add_prefix(*args)
  4355.  
  4356.     
  4357.     def add_boolean_prefix(*args):
  4358.         '''
  4359.         Add a boolean term prefix allowing the user to restrict a search with
  4360.         a boolean filter specified in the free text query.
  4361.  
  4362.         void Xapian::QueryParser::add_boolean_prefix(const std::string &field,
  4363.         const std::string &prefix)
  4364.  
  4365.         For example:
  4366.  
  4367.         This allows the user to restrict a search with site:xapian.org which
  4368.         will be converted to Hxapian.org combined with any probabilistic query
  4369.         with  Xapian::Query::OP_FILTER.
  4370.  
  4371.         If multiple boolean filters are specified in a query for the same
  4372.         prefix, they will be combined with the  Xapian::Query::OP_OR operator.
  4373.         Then, if there are boolean filters for different prefixes, they will
  4374.         be combined with the  Xapian::Query::OP_AND operator.
  4375.  
  4376.         Multiple fields can be mapped to the same prefix (so for example you
  4377.         can make site: and domain: aliases for each other). Instances of
  4378.         fields with different aliases but the same prefix will still be
  4379.         combined with the OR operator.
  4380.  
  4381.         For example, if "site" and "domain" map to "H", but author maps
  4382.         to "A", a search for "site:foo domain:bar author:Fred" will map to
  4383.         "(Hfoo OR Hbar) AND Afred".
  4384.  
  4385.         As of 1.0.4, you can call this method multiple times with the same
  4386.         value of field to allow a single field to be mapped to multiple
  4387.         prefixes. Multiple terms being generated for such a field, and
  4388.         combined with  Xapian::Query::OP_OR.
  4389.  
  4390.         Calling this method with an empty string for field will cause a
  4391.         Xapian::InvalidArgumentError.
  4392.  
  4393.         If you call  add_prefix() and  add_boolean_prefix() for the same value
  4394.         of field, a Xapian::InvalidOperationError exception will be thrown.
  4395.  
  4396.         In 1.0.3 and earlier, subsequent calls to this method with the same
  4397.         value of field had no effect.
  4398.  
  4399.         Parameters:
  4400.         -----------
  4401.  
  4402.         field:  The user visible field name
  4403.  
  4404.         prefix:  The term prefix to map this to 
  4405.         '''
  4406.         return _xapian.QueryParser_add_boolean_prefix(*args)
  4407.  
  4408.     
  4409.     def stoplist_begin(*args):
  4410.         '''
  4411.         Iterate over terms omitted from the query as stopwords.
  4412.  
  4413.         TermIterator Xapian::QueryParser::stoplist_begin() const 
  4414.         '''
  4415.         return _xapian.QueryParser_stoplist_begin(*args)
  4416.  
  4417.     
  4418.     def stoplist_end(*args):
  4419.         '''TermIterator Xapian::QueryParser::stoplist_end() const '''
  4420.         return _xapian.QueryParser_stoplist_end(*args)
  4421.  
  4422.     
  4423.     def unstem_begin(*args):
  4424.         '''
  4425.         Iterate over unstemmed forms of the given (stemmed) term used in the
  4426.         query.
  4427.  
  4428.         TermIterator Xapian::QueryParser::unstem_begin(const std::string
  4429.         &term) const 
  4430.         '''
  4431.         return _xapian.QueryParser_unstem_begin(*args)
  4432.  
  4433.     
  4434.     def unstem_end(*args):
  4435.         '''
  4436.         TermIterator
  4437.         Xapian::QueryParser::unstem_end(const std::string &) const 
  4438.         '''
  4439.         return _xapian.QueryParser_unstem_end(*args)
  4440.  
  4441.     
  4442.     def add_valuerangeprocessor(*args):
  4443.         '''
  4444.         Register a ValueRangeProcessor.
  4445.  
  4446.         void Xapian::QueryParser::add_valuerangeprocessor(Xapian::ValueRangePr
  4447.         ocessor *vrproc) 
  4448.         '''
  4449.         return _xapian.QueryParser_add_valuerangeprocessor(*args)
  4450.  
  4451.     
  4452.     def get_corrected_query_string(*args):
  4453.         '''
  4454.         Get the spelling-corrected query string.
  4455.  
  4456.         std::string Xapian::QueryParser::get_corrected_query_string() const
  4457.  
  4458.         This will only be set if FLAG_SPELLING_CORRECTION is specified when
  4459.         QueryParser::parse_query() was last called.
  4460.  
  4461.         If there were no corrections, an empty string is returned. 
  4462.         '''
  4463.         return _xapian.QueryParser_get_corrected_query_string(*args)
  4464.  
  4465.     
  4466.     def __str__(*args):
  4467.         '''
  4468.         Return a string describing this object.
  4469.  
  4470.         std::string Xapian::QueryParser::get_description() const 
  4471.         '''
  4472.         return _xapian.QueryParser___str__(*args)
  4473.  
  4474.     
  4475.     def get_description(*args):
  4476.         '''
  4477.         Return a string describing this object.
  4478.  
  4479.         std::string Xapian::QueryParser::get_description() const 
  4480.         '''
  4481.         return _xapian.QueryParser_get_description(*args)
  4482.  
  4483.  
  4484. QueryParser.set_stemmer = new_instancemethod(_xapian.QueryParser_set_stemmer, None, QueryParser)
  4485. QueryParser.set_stemming_strategy = new_instancemethod(_xapian.QueryParser_set_stemming_strategy, None, QueryParser)
  4486. QueryParser.set_stopper = new_instancemethod(_xapian.QueryParser_set_stopper, None, QueryParser)
  4487. QueryParser.set_default_op = new_instancemethod(_xapian.QueryParser_set_default_op, None, QueryParser)
  4488. QueryParser.get_default_op = new_instancemethod(_xapian.QueryParser_get_default_op, None, QueryParser)
  4489. QueryParser.set_database = new_instancemethod(_xapian.QueryParser_set_database, None, QueryParser)
  4490. QueryParser.parse_query = new_instancemethod(_xapian.QueryParser_parse_query, None, QueryParser)
  4491. QueryParser.add_prefix = new_instancemethod(_xapian.QueryParser_add_prefix, None, QueryParser)
  4492. QueryParser.add_boolean_prefix = new_instancemethod(_xapian.QueryParser_add_boolean_prefix, None, QueryParser)
  4493. QueryParser.stoplist_begin = new_instancemethod(_xapian.QueryParser_stoplist_begin, None, QueryParser)
  4494. QueryParser.stoplist_end = new_instancemethod(_xapian.QueryParser_stoplist_end, None, QueryParser)
  4495. QueryParser.unstem_begin = new_instancemethod(_xapian.QueryParser_unstem_begin, None, QueryParser)
  4496. QueryParser.unstem_end = new_instancemethod(_xapian.QueryParser_unstem_end, None, QueryParser)
  4497. QueryParser.add_valuerangeprocessor = new_instancemethod(_xapian.QueryParser_add_valuerangeprocessor, None, QueryParser)
  4498. QueryParser.get_corrected_query_string = new_instancemethod(_xapian.QueryParser_get_corrected_query_string, None, QueryParser)
  4499. QueryParser.__str__ = new_instancemethod(_xapian.QueryParser___str__, None, QueryParser)
  4500. QueryParser.get_description = new_instancemethod(_xapian.QueryParser_get_description, None, QueryParser)
  4501. QueryParser_swigregister = _xapian.QueryParser_swigregister
  4502. QueryParser_swigregister(QueryParser)
  4503. sortable_serialise = _xapian.sortable_serialise
  4504. sortable_unserialise = _xapian.sortable_unserialise
  4505.  
  4506. class Stem(object):
  4507.     '''
  4508.     Class representing a stemming algorithm. 
  4509.     '''
  4510.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4511.     __repr__ = _swig_repr
  4512.     
  4513.     def __init__(self, *args):
  4514.         """
  4515.         Construct a Xapian::Stem object for a particular language.
  4516.  
  4517.         Xapian::Stem::Stem(const std::string &language)
  4518.  
  4519.         Parameters:
  4520.         -----------
  4521.  
  4522.         language:  Either the English name for the language or the two letter
  4523.         ISO639 code.
  4524.  
  4525.         The following language names are understood (aliases follow the name):
  4526.  
  4527.         none - don't stem terms
  4528.  
  4529.         danish (da)
  4530.  
  4531.         dutch (nl)
  4532.  
  4533.         english (en) - Martin Porter's 2002 revision of his stemmer
  4534.  
  4535.         english_lovins (lovins) - Lovin's stemmer
  4536.  
  4537.         english_porter (porter) - Porter's stemmer as described in his 1980
  4538.         paper
  4539.  
  4540.         finnish (fi)
  4541.  
  4542.         french (fr)
  4543.  
  4544.         german (de)
  4545.  
  4546.         italian (it)
  4547.  
  4548.         norwegian (no)
  4549.  
  4550.         portuguese (pt)
  4551.  
  4552.         russian (ru)
  4553.  
  4554.         spanish (es)
  4555.  
  4556.         swedish (sv)
  4557.  
  4558.         Parameters:
  4559.         -----------
  4560.  
  4561.         Xapian::InvalidArgumentError:  is thrown if language isn't recognised.
  4562.  
  4563.         """
  4564.         _xapian.Stem_swiginit(self, _xapian.new_Stem(*args))
  4565.  
  4566.     __swig_destroy__ = _xapian.delete_Stem
  4567.     
  4568.     def __str__(*args):
  4569.         '''
  4570.         Return a string describing this object.
  4571.  
  4572.         std::string Xapian::Stem::get_description() const 
  4573.         '''
  4574.         return _xapian.Stem___str__(*args)
  4575.  
  4576.     get_available_languages = staticmethod(_xapian.Stem_get_available_languages)
  4577.     
  4578.     def get_description(*args):
  4579.         '''
  4580.         Return a string describing this object.
  4581.  
  4582.         std::string Xapian::Stem::get_description() const 
  4583.         '''
  4584.         return _xapian.Stem_get_description(*args)
  4585.  
  4586.  
  4587. Stem.__call__ = new_instancemethod(_xapian.Stem___call__, None, Stem)
  4588. Stem.__str__ = new_instancemethod(_xapian.Stem___str__, None, Stem)
  4589. Stem.get_description = new_instancemethod(_xapian.Stem_get_description, None, Stem)
  4590. Stem_swigregister = _xapian.Stem_swigregister
  4591. Stem_swigregister(Stem)
  4592. Stem_get_available_languages = _xapian.Stem_get_available_languages
  4593.  
  4594. class TermGenerator(object):
  4595.     '''
  4596.     Parses a piece of text and generate terms.
  4597.  
  4598.     This module takes a piece of text and parses it to produce words which
  4599.     are then used to generate suitable terms for indexing. The terms
  4600.     generated are suitable for use with Query objects produced by the
  4601.     QueryParser class. 
  4602.     '''
  4603.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4604.     __repr__ = _swig_repr
  4605.     
  4606.     def __init__(self, *args):
  4607.         '''
  4608.         Default constructor.
  4609.  
  4610.         Xapian::TermGenerator::TermGenerator() 
  4611.         '''
  4612.         _xapian.TermGenerator_swiginit(self, _xapian.new_TermGenerator(*args))
  4613.  
  4614.     __swig_destroy__ = _xapian.delete_TermGenerator
  4615.     
  4616.     def set_stemmer(*args):
  4617.         '''
  4618.         Set the Xapian::Stem object to be used for generating stemmed terms.
  4619.  
  4620.         void Xapian::TermGenerator::set_stemmer(const Xapian::Stem &stemmer)
  4621.  
  4622.         '''
  4623.         return _xapian.TermGenerator_set_stemmer(*args)
  4624.  
  4625.     
  4626.     def set_stopper(*args):
  4627.         '''
  4628.         Set the Xapian::Stopper object to be used for identifying stopwords.
  4629.  
  4630.         void Xapian::TermGenerator::set_stopper(const Xapian::Stopper
  4631.         *stop=NULL) 
  4632.         '''
  4633.         return _xapian.TermGenerator_set_stopper(*args)
  4634.  
  4635.     
  4636.     def set_document(*args):
  4637.         '''
  4638.         Set the current document.
  4639.  
  4640.         void Xapian::TermGenerator::set_document(const Xapian::Document &doc)
  4641.  
  4642.         '''
  4643.         return _xapian.TermGenerator_set_document(*args)
  4644.  
  4645.     
  4646.     def get_document(*args):
  4647.         '''
  4648.         Get the current document.
  4649.  
  4650.         const Xapian::Document& Xapian::TermGenerator::get_document() const 
  4651.         '''
  4652.         return _xapian.TermGenerator_get_document(*args)
  4653.  
  4654.     
  4655.     def set_database(*args):
  4656.         '''
  4657.         Set the database to index spelling data to.
  4658.  
  4659.         void Xapian::TermGenerator::set_database(const
  4660.         Xapian::WritableDatabase &db) 
  4661.         '''
  4662.         return _xapian.TermGenerator_set_database(*args)
  4663.  
  4664.     FLAG_SPELLING = _xapian.TermGenerator_FLAG_SPELLING
  4665.     
  4666.     def set_flags(*args):
  4667.         '''
  4668.         Set flags.
  4669.  
  4670.         flags Xapian::TermGenerator::set_flags(flags toggle, flags
  4671.         mask=flags(0))
  4672.  
  4673.         The new value of flags is: (flags & mask) ^ toggle
  4674.  
  4675.         To just set the flags, pass the new flags in toggle and the default
  4676.         value for mask.
  4677.  
  4678.         Parameters:
  4679.         -----------
  4680.  
  4681.         toggle:  Flags to XOR.
  4682.  
  4683.         mask:  Flags to AND with first.
  4684.  
  4685.         The old flags setting. 
  4686.         '''
  4687.         return _xapian.TermGenerator_set_flags(*args)
  4688.  
  4689.     
  4690.     def index_text(*args):
  4691.         '''
  4692.         Index some text in a std::string.
  4693.  
  4694.         void Xapian::TermGenerator::index_text(const std::string &text,
  4695.         Xapian::termcount weight=1, const std::string &prefix="")
  4696.  
  4697.         Parameters:
  4698.         -----------
  4699.  
  4700.         weight:  The wdf increment (default 1).
  4701.  
  4702.         prefix:  The term prefix to use (default is no prefix). 
  4703.         '''
  4704.         return _xapian.TermGenerator_index_text(*args)
  4705.  
  4706.     
  4707.     def index_text_without_positions(*args):
  4708.         '''
  4709.         Index some text in a std::string without positional information.
  4710.  
  4711.         void Xapian::TermGenerator::index_text_without_positions(const
  4712.         std::string &text, Xapian::termcount weight=1, const std::string
  4713.         &prefix="")
  4714.  
  4715.         Just like index_text, but no positional information is generated. This
  4716.         means that the database will be significantly smaller, but that phrase
  4717.         searching and NEAR won\'t be supported. 
  4718.         '''
  4719.         return _xapian.TermGenerator_index_text_without_positions(*args)
  4720.  
  4721.     
  4722.     def increase_termpos(*args):
  4723.         '''
  4724.         Increase the termpos used by index_text by delta.
  4725.  
  4726.         void Xapian::TermGenerator::increase_termpos(Xapian::termcount
  4727.         delta=100)
  4728.  
  4729.         This can be used to prevent phrase searches from spanning two
  4730.         unconnected blocks of text (e.g. the title and body text). 
  4731.         '''
  4732.         return _xapian.TermGenerator_increase_termpos(*args)
  4733.  
  4734.     
  4735.     def get_termpos(*args):
  4736.         '''
  4737.         Get the current term position.
  4738.  
  4739.         Xapian::termcount Xapian::TermGenerator::get_termpos() const 
  4740.         '''
  4741.         return _xapian.TermGenerator_get_termpos(*args)
  4742.  
  4743.     
  4744.     def set_termpos(*args):
  4745.         '''
  4746.         Set the current term position.
  4747.  
  4748.         void Xapian::TermGenerator::set_termpos(Xapian::termcount termpos) 
  4749.         '''
  4750.         return _xapian.TermGenerator_set_termpos(*args)
  4751.  
  4752.     
  4753.     def __str__(*args):
  4754.         '''
  4755.         Return a string describing this object.
  4756.  
  4757.         std::string Xapian::TermGenerator::get_description() const 
  4758.         '''
  4759.         return _xapian.TermGenerator___str__(*args)
  4760.  
  4761.  
  4762. TermGenerator.set_stemmer = new_instancemethod(_xapian.TermGenerator_set_stemmer, None, TermGenerator)
  4763. TermGenerator.set_stopper = new_instancemethod(_xapian.TermGenerator_set_stopper, None, TermGenerator)
  4764. TermGenerator.set_document = new_instancemethod(_xapian.TermGenerator_set_document, None, TermGenerator)
  4765. TermGenerator.get_document = new_instancemethod(_xapian.TermGenerator_get_document, None, TermGenerator)
  4766. TermGenerator.set_database = new_instancemethod(_xapian.TermGenerator_set_database, None, TermGenerator)
  4767. TermGenerator.set_flags = new_instancemethod(_xapian.TermGenerator_set_flags, None, TermGenerator)
  4768. TermGenerator.index_text = new_instancemethod(_xapian.TermGenerator_index_text, None, TermGenerator)
  4769. TermGenerator.index_text_without_positions = new_instancemethod(_xapian.TermGenerator_index_text_without_positions, None, TermGenerator)
  4770. TermGenerator.increase_termpos = new_instancemethod(_xapian.TermGenerator_increase_termpos, None, TermGenerator)
  4771. TermGenerator.get_termpos = new_instancemethod(_xapian.TermGenerator_get_termpos, None, TermGenerator)
  4772. TermGenerator.set_termpos = new_instancemethod(_xapian.TermGenerator_set_termpos, None, TermGenerator)
  4773. TermGenerator.__str__ = new_instancemethod(_xapian.TermGenerator___str__, None, TermGenerator)
  4774. TermGenerator_swigregister = _xapian.TermGenerator_swigregister
  4775. TermGenerator_swigregister(TermGenerator)
  4776.  
  4777. class Sorter(object):
  4778.     '''
  4779.     Virtual base class for sorter functor. 
  4780.     '''
  4781.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4782.     __repr__ = _swig_repr
  4783.     __swig_destroy__ = _xapian.delete_Sorter
  4784.     
  4785.     def __init__(self, *args):
  4786.         if self.__class__ == Sorter:
  4787.             args = (None,) + args
  4788.         else:
  4789.             args = (self,) + args
  4790.         _xapian.Sorter_swiginit(self, _xapian.new_Sorter(*args))
  4791.  
  4792.     
  4793.     def __disown__(self):
  4794.         self.this.disown()
  4795.         _xapian.disown_Sorter(self)
  4796.         return weakref_proxy(self)
  4797.  
  4798.  
  4799. Sorter.__call__ = new_instancemethod(_xapian.Sorter___call__, None, Sorter)
  4800. Sorter_swigregister = _xapian.Sorter_swigregister
  4801. Sorter_swigregister(Sorter)
  4802.  
  4803. class MultiValueSorter(Sorter):
  4804.     '''
  4805.     Sorter subclass which sorts by a several values.
  4806.  
  4807.     Results are ordered by the first value. In the event of a tie, the
  4808.     second is used. If this is the same for both, the third is used, and
  4809.     so on. 
  4810.     '''
  4811.     thisown = _swig_property((lambda x: x.this.own()), (lambda x, v: x.this.own(v)), doc = 'The membership flag')
  4812.     __repr__ = _swig_repr
  4813.     
  4814.     def __init__(self, *args):
  4815.         '''
  4816.         Xapian::MultiValueSorter::MultiValueSorter(Iterator begin, Iterator
  4817.         end) 
  4818.         '''
  4819.         _xapian.MultiValueSorter_swiginit(self, _xapian.new_MultiValueSorter(*args))
  4820.  
  4821.     
  4822.     def add(*args):
  4823.         '''
  4824.         void
  4825.         Xapian::MultiValueSorter::add(Xapian::valueno valno, bool
  4826.         forward=true) 
  4827.         '''
  4828.         return _xapian.MultiValueSorter_add(*args)
  4829.  
  4830.     __swig_destroy__ = _xapian.delete_MultiValueSorter
  4831.  
  4832. MultiValueSorter.add = new_instancemethod(_xapian.MultiValueSorter_add, None, MultiValueSorter)
  4833. MultiValueSorter_swigregister = _xapian.MultiValueSorter_swigregister
  4834. MultiValueSorter_swigregister(MultiValueSorter)
  4835. __docformat__ = 'restructuredtext en'
  4836.  
  4837. class _SequenceMixIn(object):
  4838.     '''Simple mixin class which provides a sequence API to a class.
  4839.  
  4840.     This is used to support the legacy API to iterators used for releases of
  4841.     Xapian earlier than 1.0.  It will be removed once this legacy API is
  4842.     removed in release 1.1.
  4843.  
  4844.     '''
  4845.     __slots__ = ('_sequence_items',)
  4846.     
  4847.     def __init__(self, *args):
  4848.         """Initialise the sequence.
  4849.  
  4850.         *args holds the list of properties or property names to be returned, in
  4851.         the order they are returned by the sequence API.
  4852.         
  4853.         If an item in the list is a string, it is considered to be a property
  4854.         name; otherwise, it is considered to be a property value, and is
  4855.         returned without doing an attribute lookup.  (Yes, this is a nasty
  4856.         hack.  No, I don't care, because this is only a temporary piece of
  4857.         internal code.)
  4858.  
  4859.         """
  4860.         self._sequence_items = args
  4861.  
  4862.     
  4863.     def __len__(self):
  4864.         """Get the length of the sequence.
  4865.  
  4866.         Doesn't evaluate any of the lazily evaluated properties.
  4867.  
  4868.         """
  4869.         return len(self._sequence_items)
  4870.  
  4871.     
  4872.     def _get_single_item(self, index):
  4873.         '''Get a single item.
  4874.  
  4875.         Used by __getitem__ to get individual items.
  4876.  
  4877.         '''
  4878.         if not isinstance(index, basestring):
  4879.             return index
  4880.         return getattr(self, index)
  4881.  
  4882.     
  4883.     def __getitem__(self, key):
  4884.         '''Get an item, or a slice of items, from the sequence.
  4885.  
  4886.         If any of the items are lazily evaluated properties, they will be
  4887.         evaluated here.
  4888.  
  4889.         '''
  4890.         if isinstance(key, slice):
  4891.             return [ self._get_single_item(i) for i in self._sequence_items[key] ]
  4892.         return self._get_single_item(self._sequence_items[key])
  4893.  
  4894.     
  4895.     def __iter__(self):
  4896.         '''Make an iterator for over the sequence.
  4897.  
  4898.         This simply copies the items into a list, and returns an iterator over
  4899.         it.  Any lazily evaluated properties will be evaluated here.
  4900.  
  4901.         '''
  4902.         return iter(self[:])
  4903.  
  4904.  
  4905.  
  4906. class MSetItem(_SequenceMixIn):
  4907.     '''An item returned from iteration of the MSet.
  4908.  
  4909.     The item supports access to the following attributes and properties:
  4910.  
  4911.      - `docid`: The Xapian document ID corresponding to this MSet item.
  4912.      - `weight`: The weight corresponding to this MSet item.
  4913.      - `rank`: The rank of this MSet item.  The rank is the position in the
  4914.        total set of matching documents of this item.  The highest document is
  4915.        given a rank of 0.  If the MSet did not start at the highest matching
  4916.        document, because a non-zero \'start\' parameter was supplied to
  4917.        get_mset(), the first document in the MSet will have a rank greater than
  4918.        0 (in fact, it will be equal to the value of \'start\' supplied to
  4919.        get_mset()).
  4920.      - `percent`: The percentage score assigned to this MSet item.
  4921.      - `document`: The document for this MSet item.  This can be used to access
  4922.        the document data, or any other information stored in the document (such
  4923.        as term lists).  It is lazily evaluated.
  4924.      - `collapse_key`: The value of the key which was used for collapsing.
  4925.      - `collapse_count`: An estimate of the number of documents that have been
  4926.        collapsed into this one.
  4927.  
  4928.     The collapse count estimate will always be less than or equal to the actual
  4929.     number of other documents satisfying the match criteria with the same
  4930.     collapse key as this document.  If may be 0 even though there are other
  4931.     documents with the same collapse key which satisfying the match criteria.
  4932.     However if this method returns non-zero, there definitely are other such
  4933.     documents.  So this method may be used to inform the user that there are
  4934.     "at least N other matches in this group", or to control whether to offer a
  4935.     "show other documents in this group" feature (but note that it may not
  4936.     offer it in every case where it would show other documents).
  4937.  
  4938.     '''
  4939.     __slots__ = ('_mset', '_firstitem', 'docid', 'weight', 'rank', 'percent', 'collapse_key', 'collapse_count', '_document')
  4940.     
  4941.     def __init__(self, iter, mset):
  4942.         self._mset = mset
  4943.         self._firstitem = self._mset.get_firstitem()
  4944.         self.docid = iter.get_docid()
  4945.         self.weight = iter.get_weight()
  4946.         self.rank = iter.get_rank()
  4947.         self.percent = iter.get_percent()
  4948.         self.collapse_key = iter.get_collapse_key()
  4949.         self.collapse_count = iter.get_collapse_count()
  4950.         self._document = None
  4951.         _SequenceMixIn.__init__(self, 'docid', 'weight', 'rank', 'percent', 'document')
  4952.  
  4953.     
  4954.     def _get_document(self):
  4955.         if self._document is None:
  4956.             self._document = self._mset._get_hit_internal(self.rank - self._firstitem).get_document()
  4957.         
  4958.         return self._document
  4959.  
  4960.     
  4961.     def get_docid(self):
  4962.         '''Deprecated method: use the `docid` property instead.'''
  4963.         return self.docid
  4964.  
  4965.     
  4966.     def get_weight(self):
  4967.         '''Deprecated method: use the `weight` property instead.'''
  4968.         return self.weight
  4969.  
  4970.     
  4971.     def get_rank(self):
  4972.         '''Deprecated method: use the `rank` property instead.'''
  4973.         return self.rank
  4974.  
  4975.     
  4976.     def get_percent(self):
  4977.         '''Deprecated method: use the `percent` property instead.'''
  4978.         return self.percent
  4979.  
  4980.     
  4981.     def get_collapse_key(self):
  4982.         '''Deprecated method: use the `collapse_key` property instead.'''
  4983.         return self.collapse_key
  4984.  
  4985.     
  4986.     def get_collapse_count(self):
  4987.         '''Deprecated method: use the `collapse_count` property instead.'''
  4988.         return self.collapse_count
  4989.  
  4990.     
  4991.     def get_document(self):
  4992.         '''Deprecated method: use the `document` property instead.'''
  4993.         return self.document
  4994.  
  4995.     document = property(_get_document, doc = 'The document object corresponding to this MSet item.')
  4996.  
  4997.  
  4998. class MSetIter(object):
  4999.     '''An iterator over the items in an MSet.
  5000.  
  5001.     The iterator will return MSetItem objects, which will be evaluated lazily
  5002.     where appropriate.
  5003.  
  5004.     '''
  5005.     __slots__ = ('_iter', '_end', '_mset')
  5006.     
  5007.     def __init__(self, mset):
  5008.         self._iter = mset.begin()
  5009.         self._end = mset.end()
  5010.         self._mset = mset
  5011.  
  5012.     
  5013.     def __iter__(self):
  5014.         return self
  5015.  
  5016.     
  5017.     def next(self):
  5018.         if self._iter == self._end:
  5019.             raise StopIteration
  5020.         self._iter == self._end
  5021.         r = MSetItem(self._iter, self._mset)
  5022.         self._iter.next()
  5023.         return r
  5024.  
  5025.  
  5026.  
  5027. def _mset_gen_iter(self):
  5028.     '''Return an iterator over the MSet.
  5029.  
  5030.     The iterator will return MSetItem objects, which will be evaluated lazily
  5031.     where appropriate.
  5032.  
  5033.     '''
  5034.     return MSetIter(self)
  5035.  
  5036. MSet.__iter__ = _mset_gen_iter
  5037. MSet.__len__ = MSet.size
  5038.  
  5039. def _mset_getitem(self, index):
  5040.     '''Get an item from the MSet.
  5041.  
  5042.     The supplied index is relative to the start of the MSet, not the absolute
  5043.     rank of the item.
  5044.  
  5045.     Returns an MSetItem.
  5046.  
  5047.     '''
  5048.     if index < 0:
  5049.         index += len(self)
  5050.     
  5051.     if index < 0 or index >= len(self):
  5052.         raise IndexError('Mset index out of range')
  5053.     index >= len(self)
  5054.     return MSetItem(self._get_hit_internal(index), self)
  5055.  
  5056. MSet.__getitem__ = _mset_getitem
  5057. MSet.get_hit = _mset_getitem
  5058.  
  5059. def _mset_contains(self, index):
  5060.     '''Check if the Mset contains an item at the given index
  5061.  
  5062.     The supplied index is relative to the start of the MSet, not the absolute
  5063.     rank of the item.
  5064.  
  5065.     '''
  5066.     if key >= 0:
  5067.         pass
  5068.     return key < len(self)
  5069.  
  5070. MSet.__contains__ = _mset_contains
  5071.  
  5072. class ESetItem(_SequenceMixIn):
  5073.     '''An item returned from iteration of the ESet.
  5074.  
  5075.     The item supports access to the following attributes:
  5076.  
  5077.      - `term`: The term corresponding to this ESet item.
  5078.      - `weight`: The weight corresponding to this ESet item.
  5079.  
  5080.     '''
  5081.     __slots__ = ('term', 'weight')
  5082.     
  5083.     def __init__(self, iter):
  5084.         self.term = iter.get_term()
  5085.         self.weight = iter.get_weight()
  5086.         _SequenceMixIn.__init__(self, 'term', 'weight')
  5087.  
  5088.  
  5089.  
  5090. class ESetIter(object):
  5091.     '''An iterator over the items in an ESet.
  5092.  
  5093.     The iterator will return ESetItem objects.
  5094.  
  5095.     '''
  5096.     __slots__ = ('_iter', '_end')
  5097.     
  5098.     def __init__(self, eset):
  5099.         self._iter = eset.begin()
  5100.         self._end = eset.end()
  5101.  
  5102.     
  5103.     def __iter__(self):
  5104.         return self
  5105.  
  5106.     
  5107.     def next(self):
  5108.         if self._iter == self._end:
  5109.             raise StopIteration
  5110.         self._iter == self._end
  5111.         r = ESetItem(self._iter)
  5112.         self._iter.next()
  5113.         return r
  5114.  
  5115.  
  5116.  
  5117. def _eset_gen_iter(self):
  5118.     '''Return an iterator over the ESet.
  5119.     
  5120.     The iterator will return ESetItem objects.
  5121.  
  5122.     '''
  5123.     return ESetIter(self)
  5124.  
  5125. ESet.__iter__ = _eset_gen_iter
  5126. ESet.__len__ = ESet.size
  5127.  
  5128. class TermListItem(_SequenceMixIn):
  5129.     '''An item returned from iteration of a term list.
  5130.  
  5131.     The item supports access to the following attributes and properties:
  5132.  
  5133.      - `term`: The term corresponding to this TermListItem.
  5134.      - `wdf`: The within document frequency of this term.
  5135.      - `termfreq`: The number of documents in the collection which are indexed
  5136.        by the term
  5137.      - `positer`: An iterator over the positions which the term appears at in
  5138.        the document.  This is only available until the iterator which returned
  5139.        this item next moves.
  5140.  
  5141.     '''
  5142.     __slots__ = ('_iter', 'term', '_wdf', '_termfreq')
  5143.     
  5144.     def __init__(self, iter, term):
  5145.         self._iter = iter
  5146.         self.term = term
  5147.         self._wdf = None
  5148.         self._termfreq = None
  5149.         if iter._has_wdf == TermIter.EAGER:
  5150.             self._wdf = iter._iter.get_wdf()
  5151.         
  5152.         if iter._has_termfreq == TermIter.EAGER:
  5153.             self._termfreq = iter._iter.get_termfreq()
  5154.         
  5155.         sequence = [
  5156.             'term',
  5157.             'wdf',
  5158.             'termfreq',
  5159.             'positer']
  5160.         if iter._has_wdf == TermIter.INVALID:
  5161.             sequence[1] = 0
  5162.         
  5163.         if iter._has_termfreq == TermIter.INVALID:
  5164.             sequence[2] = 0
  5165.         
  5166.         if iter._has_positions == TermIter.INVALID:
  5167.             sequence[3] = PositionIter()
  5168.         
  5169.         _SequenceMixIn.__init__(self, *sequence)
  5170.  
  5171.     
  5172.     def _get_wdf(self):
  5173.         """Get the within-document-frequency of the current term.
  5174.  
  5175.         This will raise a InvalidOperationError exception if the iterator this
  5176.         item came from doesn't support within-document-frequencies.
  5177.  
  5178.         """
  5179.         if self._wdf is None:
  5180.             if self._iter._has_wdf == TermIter.INVALID:
  5181.                 raise InvalidOperationError('Iterator does not support wdfs')
  5182.             self._iter._has_wdf == TermIter.INVALID
  5183.             if self.term is not self._iter._lastterm:
  5184.                 raise InvalidOperationError('Iterator has moved, and does not support random access')
  5185.             self.term is not self._iter._lastterm
  5186.             self._wdf = self._iter._iter.get_wdf()
  5187.         
  5188.         return self._wdf
  5189.  
  5190.     wdf = property(_get_wdf, doc = "The within-document-frequency of the current term (if meaningful).\n\n    This will raise a InvalidOperationError exception if the iterator\n    this item came from doesn't support within-document-frequencies.\n\n    ")
  5191.     
  5192.     def _get_termfreq(self):
  5193.         """Get the term frequency.
  5194.  
  5195.         This is the number of documents in the collection which are indexed by
  5196.         the term.
  5197.  
  5198.         This will raise a InvalidOperationError exception if the iterator this
  5199.         item came from doesn't support term frequencies.
  5200.  
  5201.         """
  5202.         if self._termfreq is None:
  5203.             if self._iter._has_termfreq == TermIter.INVALID:
  5204.                 raise InvalidOperationError('Iterator does not support term frequencies')
  5205.             self._iter._has_termfreq == TermIter.INVALID
  5206.             if self.term is not self._iter._lastterm:
  5207.                 raise InvalidOperationError('Iterator has moved, and does not support random access')
  5208.             self.term is not self._iter._lastterm
  5209.             self._termfreq = self._iter._iter.get_termfreq()
  5210.         
  5211.         return self._termfreq
  5212.  
  5213.     termfreq = property(_get_termfreq, doc = "The term frequency of the current term (if meaningful).\n\n    This is the number of documents in the collection which are indexed by the\n    term.\n\n    This will raise a InvalidOperationError exception if the iterator\n    this item came from doesn't support term frequencies.\n\n    ")
  5214.     
  5215.     def _get_positer(self):
  5216.         """Get a position list iterator.
  5217.  
  5218.         The iterator will return integers representing the positions that the
  5219.         term occurs at.
  5220.  
  5221.         This will raise a InvalidOperationError exception if the iterator this
  5222.         item came from doesn't support position lists, or if the iterator has
  5223.         moved on since the item was returned from it.
  5224.  
  5225.         """
  5226.         if self._iter._has_positions == TermIter.INVALID:
  5227.             raise InvalidOperationError('Iterator does not support position lists')
  5228.         self._iter._has_positions == TermIter.INVALID
  5229.         if self.term is not self._iter._lastterm:
  5230.             raise InvalidOperationError('Iterator has moved, and does not support random access')
  5231.         self.term is not self._iter._lastterm
  5232.         return PositionIter(self._iter._iter.positionlist_begin(), self._iter._iter.positionlist_end())
  5233.  
  5234.     positer = property(_get_positer, doc = "A position iterator for the current term (if meaningful).\n\n    The iterator will return integers representing the positions that the term\n    occurs at.\n\n    This will raise a InvalidOperationError exception if the iterator this item\n    came from doesn't support position lists, or if the iterator has moved on\n    since the item was returned from it.\n\n    ")
  5235.  
  5236.  
  5237. class TermIter(object):
  5238.     '''An iterator over a term list.
  5239.  
  5240.     The iterator will return TermListItem objects, which will be evaluated
  5241.     lazily where appropriate.
  5242.  
  5243.     '''
  5244.     __slots__ = ('_iter', '_end', '_has_termfreq', '_has_wdf', '_has_positions', '_return_strings', '_lastterm', '_moved')
  5245.     INVALID = 0
  5246.     LAZY = 1
  5247.     EAGER = 2
  5248.     
  5249.     def __init__(self, start, end, has_termfreq = INVALID, has_wdf = INVALID, has_positions = INVALID, return_strings = False):
  5250.         self._iter = start
  5251.         self._end = end
  5252.         self._has_termfreq = has_termfreq
  5253.         self._has_wdf = has_wdf
  5254.         self._has_positions = has_positions
  5255.         if not has_positions != TermIter.EAGER:
  5256.             raise AssertionError
  5257.         self._return_strings = return_strings
  5258.         self._lastterm = None
  5259.         self._moved = True
  5260.  
  5261.     
  5262.     def __iter__(self):
  5263.         return self
  5264.  
  5265.     
  5266.     def next(self):
  5267.         if not self._moved:
  5268.             self._iter.next()
  5269.             self._moved = True
  5270.         
  5271.         if self._iter == self._end:
  5272.             self._lastterm = None
  5273.             raise StopIteration
  5274.         self._iter == self._end
  5275.         self._lastterm = self._iter.get_term()
  5276.         self._moved = False
  5277.         if self._return_strings:
  5278.             return self._lastterm
  5279.         return TermListItem(self, self._lastterm)
  5280.  
  5281.     
  5282.     def skip_to(self, term):
  5283.         '''Skip the iterator forward.
  5284.  
  5285.         The iterator is advanced to the first term at or after the current
  5286.         position which is greater than or equal to the supplied term.
  5287.  
  5288.         If there are no such items, this will raise StopIteration.
  5289.  
  5290.         This returns the item which the iterator is moved to.  The subsequent
  5291.         item will be returned the next time that next() is called (unless
  5292.         skip_to() is called again first).
  5293.  
  5294.         '''
  5295.         if self._iter != self._end:
  5296.             self._iter.skip_to(term)
  5297.         
  5298.         if self._iter == self._end:
  5299.             self._lastterm = None
  5300.             self._moved = True
  5301.             raise StopIteration
  5302.         self._iter == self._end
  5303.         newterm = self._iter.get_term()
  5304.         if newterm != self._lastterm:
  5305.             self._lastterm = newterm
  5306.         
  5307.         self._moved = False
  5308.         if self._return_strings:
  5309.             return self._lastterm
  5310.         return TermListItem(self, self._lastterm)
  5311.  
  5312.  
  5313.  
  5314. def _enquire_gen_iter(self, which):
  5315.     '''Get an iterator over the terms which match a given match set item.
  5316.  
  5317.     The match set item to consider is specified by the `which` parameter, which
  5318.     may be a document ID, or an MSetItem object.
  5319.  
  5320.     The iterator will return string objects.
  5321.  
  5322.     '''
  5323.     if isinstance(which, MSetItem):
  5324.         which = which.docid
  5325.     
  5326.     return TermIter(self.get_matching_terms_begin(which), self.get_matching_terms_end(which), return_strings = True)
  5327.  
  5328. Enquire.matching_terms = _enquire_gen_iter
  5329. Enquire.get_matching_terms = _enquire_gen_iter
  5330.  
  5331. def _query_gen_iter(self):
  5332.     '''Get an iterator over the terms in a query.
  5333.  
  5334.     The iterator will return string objects.
  5335.  
  5336.     '''
  5337.     return TermIter(self.get_terms_begin(), self.get_terms_end(), return_strings = True)
  5338.  
  5339. Query.__iter__ = _query_gen_iter
  5340.  
  5341. def _database_gen_allterms_iter(self, prefix = None):
  5342.     '''Get an iterator over all the terms in the database.
  5343.  
  5344.     The iterator will return TermListItem objects, but these will not support
  5345.     access to wdf, or position information.
  5346.  
  5347.     Access to term frequency information is only available until the iterator
  5348.     has moved on.
  5349.  
  5350.     If prefix is supplied, only terms which start with that prefix will be
  5351.     returned.
  5352.  
  5353.     '''
  5354.     if prefix is None:
  5355.         return TermIter(self.allterms_begin(), self.allterms_end(), has_termfreq = TermIter.LAZY)
  5356.     return TermIter(self.allterms_begin(prefix), self.allterms_end(prefix), has_termfreq = TermIter.LAZY)
  5357.  
  5358. Database.__iter__ = _database_gen_allterms_iter
  5359. Database.allterms = _database_gen_allterms_iter
  5360.  
  5361. def _database_gen_termlist_iter(self, docid):
  5362.     '''Get an iterator over all the terms which index a given document ID.
  5363.  
  5364.     The iterator will return TermListItem objects.
  5365.  
  5366.     Access to term frequency and position information is only available until
  5367.     the iterator has moved on.
  5368.  
  5369.     '''
  5370.     return TermIter(self.termlist_begin(docid), self.termlist_end(docid), has_termfreq = TermIter.LAZY, has_wdf = TermIter.EAGER, has_positions = TermIter.LAZY)
  5371.  
  5372. Database.termlist = _database_gen_termlist_iter
  5373.  
  5374. def _database_gen_spellings_iter(self):
  5375.     '''Get an iterator which returns all the spelling correction targets
  5376.  
  5377.     The iterator will return TermListItem objects.  Only the term frequency is
  5378.     available; wdf and positions are not meaningful.
  5379.  
  5380.     '''
  5381.     return TermIter(self.spellings_begin(), self.spellings_end(), has_termfreq = TermIter.EAGER, has_wdf = TermIter.INVALID, has_positions = TermIter.INVALID)
  5382.  
  5383. Database.spellings = _database_gen_spellings_iter
  5384.  
  5385. def _database_gen_synonyms_iter(self, term):
  5386.     '''Get an iterator which returns all the synonyms for a given term.
  5387.  
  5388.     The term to return synonyms for is specified by the `term` parameter.
  5389.  
  5390.     The iterator will return string objects.
  5391.  
  5392.     '''
  5393.     return TermIter(self.synonyms_begin(term), self.synonyms_end(term), return_strings = True)
  5394.  
  5395. Database.synonyms = _database_gen_synonyms_iter
  5396.  
  5397. def _database_gen_synonym_keys_iter(self, prefix = ''):
  5398.     '''Get an iterator which returns all the terms which have synonyms.
  5399.  
  5400.     The iterator will return string objects.
  5401.  
  5402.     If `prefix` is non-empty, only terms with this prefix are returned.
  5403.  
  5404.     '''
  5405.     return TermIter(self.synonym_keys_begin(prefix), self.synonym_keys_end(prefix), return_strings = True)
  5406.  
  5407. Database.synonym_keys = _database_gen_synonym_keys_iter
  5408.  
  5409. def _database_gen_metadata_keys_iter(self, prefix = ''):
  5410.     '''Get an iterator which returns all the metadata keys.
  5411.  
  5412.     The iterator will return string objects.
  5413.  
  5414.     If `prefix` is non-empty, only metadata keys with this prefix are returned.
  5415.  
  5416.     '''
  5417.     return TermIter(self._metadata_keys_begin(prefix), self._metadata_keys_end(prefix), return_strings = True)
  5418.  
  5419. Database.metadata_keys = _database_gen_metadata_keys_iter
  5420.  
  5421. def _document_gen_termlist_iter(self):
  5422.     '''Get an iterator over all the terms in a document.
  5423.  
  5424.     The iterator will return TermListItem objects.
  5425.  
  5426.     Access to term frequency and position information is only available until
  5427.     the iterator has moved on.
  5428.  
  5429.     Note that term frequency information is only meaningful for a document
  5430.     retrieved from a database.  If term frequency information is requested for
  5431.     a document which was freshly created, an InvalidOperationError will be
  5432.     raised.
  5433.  
  5434.     '''
  5435.     return TermIter(self.termlist_begin(), self.termlist_end(), has_termfreq = TermIter.LAZY, has_wdf = TermIter.EAGER, has_positions = TermIter.LAZY)
  5436.  
  5437. Document.__iter__ = _document_gen_termlist_iter
  5438. Document.termlist = _document_gen_termlist_iter
  5439.  
  5440. def _queryparser_gen_stoplist_iter(self):
  5441.     '''Get an iterator over all the stopped terms from the previous query.
  5442.     
  5443.     This returns an iterator over all the terms which were omitted from the
  5444.     previously parsed query due to being considered to be stopwords.  Each
  5445.     instance of a word omitted from the query is represented in the returned
  5446.     list, in the order in which the
  5447.  
  5448.     The iterator will return string objects.
  5449.  
  5450.     '''
  5451.     return TermIter(self.stoplist_begin(), self.stoplist_end(), return_strings = True)
  5452.  
  5453. QueryParser.stoplist = _queryparser_gen_stoplist_iter
  5454.  
  5455. def _queryparser_gen_unstemlist_iter(self, tname):
  5456.     '''Get an iterator over all the unstemmed forms of a stemmed term.
  5457.     
  5458.     This returns an iterator which returns all the unstemmed words which were
  5459.     stemmed to the stemmed form specifed by `tname` when parsing the previous
  5460.     query.  Each instance of a word which stems to `tname` is returned by the
  5461.     iterator in the order in which the words appeared in the query - an
  5462.     individual unstemmed word may thus occur multiple times.
  5463.  
  5464.     The iterator will return string objects.
  5465.  
  5466.     '''
  5467.     return TermIter(self.unstem_begin(tname), self.unstem_end(tname), return_strings = True)
  5468.  
  5469. QueryParser.unstemlist = _queryparser_gen_unstemlist_iter
  5470. __queryparser_add_valuerangeprocessor_orig = QueryParser.add_valuerangeprocessor
  5471.  
  5472. def _queryparser_add_valuerangeprocessor(self, vrproc):
  5473.     if not hasattr(self, '_vrps'):
  5474.         self._vrps = []
  5475.     
  5476.     self._vrps.append(vrproc)
  5477.     return __queryparser_add_valuerangeprocessor_orig(self, vrproc)
  5478.  
  5479. _queryparser_add_valuerangeprocessor.__doc__ = __queryparser_add_valuerangeprocessor_orig.__doc__
  5480. QueryParser.add_valuerangeprocessor = _queryparser_add_valuerangeprocessor
  5481. del _queryparser_add_valuerangeprocessor
  5482. __queryparser_set_stopper_orig = QueryParser.set_stopper
  5483.  
  5484. def _queryparser_set_stopper(self, stopper):
  5485.     self._stopper = stopper
  5486.     return __queryparser_set_stopper_orig(self, stopper)
  5487.  
  5488. _queryparser_set_stopper.__doc__ = __queryparser_set_stopper_orig.__doc__
  5489. QueryParser.set_stopper = _queryparser_set_stopper
  5490. del _queryparser_set_stopper
  5491. __termgenerator_set_stopper_orig = TermGenerator.set_stopper
  5492.  
  5493. def _termgenerator_set_stopper(self, stopper):
  5494.     self._stopper = stopper
  5495.     return __termgenerator_set_stopper_orig(self, stopper)
  5496.  
  5497. _termgenerator_set_stopper.__doc__ = __termgenerator_set_stopper_orig.__doc__
  5498. TermGenerator.set_stopper = _termgenerator_set_stopper
  5499. del _termgenerator_set_stopper
  5500.  
  5501. def _enquire_check_deprec_args(reverse, kwargs, methodname):
  5502.     '''Check the keyword arguments to one of the enquire set_sort_* methods.
  5503.     
  5504.     '''
  5505.     if reverse is not None:
  5506.         if 'ascending' in kwargs:
  5507.             raise TypeError('Only one of "reverse" and "ascending" may be specified')
  5508.         'ascending' in kwargs
  5509.         if len(kwargs) != 0:
  5510.             raise TypeError('Only keyword arguments allowed are "reverse" and "ascending"')
  5511.         len(kwargs) != 0
  5512.     elif 'ascending' in kwargs:
  5513.         reverse = kwargs.get('ascending')
  5514.         del kwargs['ascending']
  5515.     else:
  5516.         reverse = True
  5517.     if len(kwargs) != 0:
  5518.         raise TypeError('Only keyword arguments allowed are "reverse" and "ascending"')
  5519.     len(kwargs) != 0
  5520.     return reverse
  5521.  
  5522. __enquire_set_sort_by_key_orig = Enquire.set_sort_by_key
  5523.  
  5524. def _enquire_set_sort_by_key(self, sorter, reverse = None, **kwargs):
  5525.     self._sorter = sorter
  5526.     reverse = _enquire_check_deprec_args(reverse, kwargs, 'set_sort_by_key')
  5527.     return __enquire_set_sort_by_key_orig(self, sorter, reverse)
  5528.  
  5529. _enquire_set_sort_by_key.__doc__ = __enquire_set_sort_by_key_orig.__doc__
  5530. Enquire.set_sort_by_key = _enquire_set_sort_by_key
  5531. del _enquire_set_sort_by_key
  5532. __enquire_set_sort_by_key_then_relevance_orig = Enquire.set_sort_by_key_then_relevance
  5533.  
  5534. def _enquire_set_sort_by_key_then_relevance(self, sorter, reverse = None, **kwargs):
  5535.     self._sorter = sorter
  5536.     reverse = _enquire_check_deprec_args(reverse, kwargs, 'set_sort_by_key_then_relevance')
  5537.     return __enquire_set_sort_by_key_then_relevance_orig(self, sorter, reverse)
  5538.  
  5539. _enquire_set_sort_by_key_then_relevance.__doc__ = __enquire_set_sort_by_key_then_relevance_orig.__doc__
  5540. Enquire.set_sort_by_key_then_relevance = _enquire_set_sort_by_key_then_relevance
  5541. del _enquire_set_sort_by_key_then_relevance
  5542. __enquire_set_sort_by_relevance_then_key_orig = Enquire.set_sort_by_relevance_then_key
  5543.  
  5544. def _enquire_set_sort_by_relevance_then_key(self, sorter, reverse = None, **kwargs):
  5545.     self._sorter = sorter
  5546.     reverse = _enquire_check_deprec_args(reverse, kwargs, 'set_sort_by_relevance_then_key')
  5547.     return __enquire_set_sort_by_relevance_then_key_orig(self, sorter, reverse)
  5548.  
  5549. _enquire_set_sort_by_relevance_then_key.__doc__ = __enquire_set_sort_by_relevance_then_key_orig.__doc__
  5550. Enquire.set_sort_by_relevance_then_key = _enquire_set_sort_by_relevance_then_key
  5551. del _enquire_set_sort_by_relevance_then_key
  5552. __enquire_set_sort_by_value_orig = Enquire.set_sort_by_value
  5553.  
  5554. def _enquire_set_sort_by_value(self, sort_key, reverse = None, **kwargs):
  5555.     reverse = _enquire_check_deprec_args(reverse, kwargs, 'set_sort_by_value')
  5556.     return __enquire_set_sort_by_value_orig(self, sort_key, reverse)
  5557.  
  5558. _enquire_set_sort_by_value.__doc__ = __enquire_set_sort_by_value_orig.__doc__
  5559. Enquire.set_sort_by_value = _enquire_set_sort_by_value
  5560. del _enquire_set_sort_by_value
  5561. __enquire_set_sort_by_relevance_then_value_orig = Enquire.set_sort_by_relevance_then_value
  5562.  
  5563. def _enquire_set_sort_by_relevance_then_value(self, sort_key, reverse = None, **kwargs):
  5564.     reverse = _enquire_check_deprec_args(reverse, kwargs, 'set_sort_by_relevance_then_value')
  5565.     return __enquire_set_sort_by_relevance_then_value_orig(self, sort_key, reverse)
  5566.  
  5567. _enquire_set_sort_by_relevance_then_value.__doc__ = __enquire_set_sort_by_relevance_then_value_orig.__doc__
  5568. Enquire.set_sort_by_relevance_then_value = _enquire_set_sort_by_relevance_then_value
  5569. del _enquire_set_sort_by_relevance_then_value
  5570. __enquire_set_sort_by_value_then_relevance_orig = Enquire.set_sort_by_value_then_relevance
  5571.  
  5572. def _enquire_set_sort_by_value_then_relevance(self, sort_key, reverse = None, **kwargs):
  5573.     reverse = _enquire_check_deprec_args(reverse, kwargs, 'set_sort_by_value_then_relevance')
  5574.     return __enquire_set_sort_by_value_then_relevance_orig(self, sort_key, reverse)
  5575.  
  5576. _enquire_set_sort_by_value_then_relevance.__doc__ = __enquire_set_sort_by_value_then_relevance_orig.__doc__
  5577. Enquire.set_sort_by_value_then_relevance = _enquire_set_sort_by_value_then_relevance
  5578. del _enquire_set_sort_by_value_then_relevance
  5579.  
  5580. class PostingItem(_SequenceMixIn):
  5581.     '''An item returned from iteration of a posting list.
  5582.  
  5583.     The item supports access to the following attributes and properties:
  5584.  
  5585.      - `docid`: The document ID corresponding to this PostingItem.
  5586.      - `doclength`: The length of the document corresponding to this
  5587.        PostingItem.
  5588.      - `wdf`: The within document frequency of the term which the posting list
  5589.        is for in the document corresponding to this PostingItem.
  5590.      - `positer`: An iterator over the positions which the term corresponing to
  5591.        this posting list occurs at in the document corresponding to this
  5592.        PostingItem.  This is only available until the iterator which returned
  5593.        this item next moves.
  5594.  
  5595.     '''
  5596.     __slots__ = ('_iter', 'docid', 'doclength', 'wdf')
  5597.     
  5598.     def __init__(self, iter):
  5599.         self._iter = iter
  5600.         self.docid = iter._iter.get_docid()
  5601.         self.doclength = iter._iter.get_doclength()
  5602.         self.wdf = iter._iter.get_wdf()
  5603.         sequence = [
  5604.             'docid',
  5605.             'doclength',
  5606.             'wdf',
  5607.             'positer']
  5608.         if not iter._has_positions:
  5609.             sequence[3] = PositionIter()
  5610.         
  5611.         _SequenceMixIn.__init__(self, *sequence)
  5612.  
  5613.     
  5614.     def _get_positer(self):
  5615.         """Get a position list iterator.
  5616.  
  5617.         The iterator will return integers representing the positions that the
  5618.         term occurs at in the document corresponding to this PostingItem.
  5619.  
  5620.         This will raise a InvalidOperationError exception if the iterator this
  5621.         item came from doesn't support position lists, or if the iterator has
  5622.         moved on since the item was returned from it.
  5623.  
  5624.         """
  5625.         if not self._iter._has_positions:
  5626.             raise InvalidOperationError('Iterator does not support position lists')
  5627.         self._iter._has_positions
  5628.         if self._iter._iter == self._iter._end or self.docid != self._iter._iter.get_docid():
  5629.             raise InvalidOperationError('Iterator has moved, and does not support random access')
  5630.         self.docid != self._iter._iter.get_docid()
  5631.         return PositionIter(self._iter._iter.positionlist_begin(), self._iter._iter.positionlist_end())
  5632.  
  5633.     positer = property(_get_positer, doc = "A position iterator for the current posting (if meaningful).\n\n    The iterator will return integers representing the positions that the term\n    occurs at.\n\n    This will raise a InvalidOperationError exception if the iterator this item\n    came from doesn't support position lists, or if the iterator has moved on\n    since the item was returned from it.\n\n    ")
  5634.  
  5635.  
  5636. class PostingIter(object):
  5637.     '''An iterator over a posting list.
  5638.  
  5639.     The iterator will return PostingItem objects, which will be evaluated
  5640.     lazily where appropriate.
  5641.  
  5642.     '''
  5643.     __slots__ = ('_iter', '_end', '_has_positions', '_moved')
  5644.     
  5645.     def __init__(self, start, end, has_positions = False):
  5646.         self._iter = start
  5647.         self._end = end
  5648.         self._has_positions = has_positions
  5649.         self._moved = True
  5650.  
  5651.     
  5652.     def __iter__(self):
  5653.         return self
  5654.  
  5655.     
  5656.     def next(self):
  5657.         if not self._moved:
  5658.             self._iter.next()
  5659.             self._moved = True
  5660.         
  5661.         if self._iter == self._end:
  5662.             raise StopIteration
  5663.         self._iter == self._end
  5664.         self._moved = False
  5665.         return PostingItem(self)
  5666.  
  5667.     
  5668.     def skip_to(self, docid):
  5669.         '''Skip the iterator forward.
  5670.  
  5671.         The iterator is advanced to the first document with a document ID
  5672.         which is greater than or equal to the supplied document ID.
  5673.  
  5674.         If there are no such items, this will raise StopIteration.
  5675.  
  5676.         This returns the item which the iterator is moved to.  The subsequent
  5677.         item will be returned the next time that next() is called (unless
  5678.         skip_to() is called again first).
  5679.  
  5680.         '''
  5681.         if self._iter != self._end:
  5682.             self._iter.skip_to(docid)
  5683.         
  5684.         if self._iter == self._end:
  5685.             self._moved = True
  5686.             raise StopIteration
  5687.         self._iter == self._end
  5688.         self._moved = False
  5689.         return PostingItem(self)
  5690.  
  5691.  
  5692.  
  5693. def _database_gen_postlist_iter(self, tname):
  5694.     '''Get an iterator over the postings which are indexed by a given term.
  5695.  
  5696.     If `tname` is empty, an iterator over all the documents will be returned
  5697.     (this will contain one entry for each document, will always return a wdf of
  5698.     1, and will not allow access to a position iterator).
  5699.  
  5700.     '''
  5701.     if len(tname) != 0:
  5702.         return PostingIter(self.postlist_begin(tname), self.postlist_end(tname), has_positions = True)
  5703.     return PostingIter(self.postlist_begin(tname), self.postlist_end(tname))
  5704.  
  5705. Database.postlist = _database_gen_postlist_iter
  5706.  
  5707. class PositionIter(object):
  5708.     '''An iterator over a position list.
  5709.  
  5710.     The iterator will return integers, in ascending order.
  5711.  
  5712.     '''
  5713.     
  5714.     def __init__(self, start = 0, end = 0):
  5715.         self.iter = start
  5716.         self.end = end
  5717.  
  5718.     
  5719.     def __iter__(self):
  5720.         return self
  5721.  
  5722.     
  5723.     def next(self):
  5724.         if self.iter == self.end:
  5725.             raise StopIteration
  5726.         self.iter == self.end
  5727.         r = self.iter.get_termpos()
  5728.         self.iter.next()
  5729.         return r
  5730.  
  5731.  
  5732.  
  5733. def _database_gen_positionlist_iter(self, docid, tname):
  5734.     '''Get an iterator over all the positions in a given document of a term.
  5735.     
  5736.     The iterator will return integers, in ascending order.
  5737.  
  5738.     '''
  5739.     return PositionIter(self.positionlist_begin(docid, tname), self.positionlist_end(docid, tname))
  5740.  
  5741. Database.positionlist = _database_gen_positionlist_iter
  5742.  
  5743. class ValueItem(_SequenceMixIn):
  5744.     '''An item returned from iteration of the values in a document.
  5745.  
  5746.     The item supports access to the following attributes:
  5747.  
  5748.      - `num`: The number of the value.
  5749.      - `value`: The contents of the value.
  5750.  
  5751.     '''
  5752.     __slots__ = ('num', 'value')
  5753.     
  5754.     def __init__(self, num, value):
  5755.         self.num = num
  5756.         self.value = value
  5757.         _SequenceMixIn.__init__(self, 'num', 'value')
  5758.  
  5759.  
  5760.  
  5761. class ValueIter(object):
  5762.     '''An iterator over all the values stored in a document.
  5763.  
  5764.     The iterator will return ValueItem objects, in ascending order of value number.
  5765.  
  5766.     '''
  5767.     
  5768.     def __init__(self, start, end):
  5769.         self.iter = start
  5770.         self.end = end
  5771.  
  5772.     
  5773.     def __iter__(self):
  5774.         return self
  5775.  
  5776.     
  5777.     def next(self):
  5778.         if self.iter == self.end:
  5779.             raise StopIteration
  5780.         self.iter == self.end
  5781.         r = ValueItem(self.iter.get_valueno(), self.iter.get_value())
  5782.         self.iter.next()
  5783.         return r
  5784.  
  5785.  
  5786.  
  5787. def _document_gen_values_iter(self):
  5788.     '''Get an iterator over all the values stored in a document.
  5789.  
  5790.     The iterator will return ValueItem objects, in ascending order of value number.
  5791.  
  5792.     '''
  5793.     return ValueIter(self.values_begin(), self.values_end())
  5794.  
  5795. Document.values = _document_gen_values_iter
  5796. __all__ = []
  5797. for item in dir():
  5798.     if item.startswith('_') and item.endswith('_swigregister') or item.endswith('Iterator'):
  5799.         continue
  5800.     
  5801.     __all__.append(item)
  5802.  
  5803. __all__ = tuple(__all__)
  5804.